Alphabetical Separation And Search Of Brands (Query Help)

Is there anything obvious and wrong with this query?
alphabetical separation and Trademark search
If there is an error and an open Sql query, please help.

It works this way, but it fails when you search for a SQL query.

Quotation marks ( ' )

sample search word : kelime'nin
			<span>Message </span>
	
	
		
			<div style="color:rgb(51,51,51);font-family:Arial, Helvetica, sans-serif;font-size:16px;font-style:normal;font-weight:400;background-color:rgb(255,255,255);">picture attached</div>
		
		
			<span>You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'nin%' and cscart_product_feature_variants.feature_id=2' at line 1 (1064)SELECT * FROM `cscart_product_feature_variants` INNER JOIN `cscart_product_feature_variant_descriptions` on cscart_product_feature_variants.variant_id=cscart_product_feature_variant_descriptions.variant_id WHERE cscart_product_feature_variant_descriptions.variant LIKE '%kelime'nin%' and cscart_product_feature_variants.feature_id=2</span>
<?php
    use Tygh\Enum\ProductFeatures;
    use Tygh\Registry;
    if (!defined('BOOTSTRAP')) { die('Access denied'); }

function fn_yazar_ver($deger){
$result = db_query(“SELECT
?:product_feature_variant_descriptions.variant,
?:product_feature_variants.variant_id,
?:product_feature_variants.feature_id
FROM ?:product_feature_variants
INNER JOIN
?:product_feature_variant_descriptions ON
?:product_feature_variant_descriptions.variant_id =
?:product_feature_variants.variant_id
WHERE ?:product_feature_variants.feature_id=2 order by ?:product_feature_variant_descriptions.variant ASC”);
return $result;
}

function fn_yazar_search($like){
$result = db_query(“SELECT *
FROM ?:product_feature_variants
INNER JOIN ?:product_feature_variant_descriptions on ?:product_feature_variants.variant_id=?:product_feature_variant_descriptions.variant_id
WHERE ?:product_feature_variant_descriptions.variant LIKE '%”.$like.“%’ and ?:product_feature_variants.feature_id=2”);
return $result;
}

$variants = array();
$searchs = array();
$publisher = array();

$harf = strtoupper ($_GET['harf']);

if (!empty($_GET[“yazar”])) {
$search = fn_yazar_search($_GET[‘yazar’]);
foreach($search as $variant){
$searchs[mb_substr(strtoupper ($variant[‘variant’]), 0, 1)][] = $variant;
}
}

if($harf){
	$degergeldi = fn_yazar_ver($deger);
    foreach ($degergeldi as $variant) {
        $string = mb_substr(strtoupper ($variant['variant']), 0, 1);

        if(is_numeric($string)){
            $variants['0-9'][] = $variant;
        }else{
            $variants[$string][] = $variant;
        }

        if($harf == '0-9'){
            if(is_numeric($string)){
            $publisher['0-9'][] = $variant;
            }
        }elseif($harf == $string){
            $publisher[$harf][] = $variant;
        }
    
        sort();
    }
}else{
	$degergeldi = fn_yazar_ver($deger);
    foreach ($degergeldi as $variant){
        $string = mb_substr($variant['variant'], 0, 1);
        if(is_numeric($string)){
            $variants['0-9'][] = $variant;
        }else{
            $variants[mb_substr(strtoupper ($variant['variant']), 0, 1)][] = $variant;
        }

        sort();
    }
}

Tygh::$app['view']->assign('publisher', $publisher);	  
Tygh::$app['view']->assign('names', $harf);
Tygh::$app['view']->assign('searchs', $searchs);
Tygh::$app['view']->assign('variants', $variants);    

2018-03-18_00-38-26.png

$like =urlencode($like);

is there a solution?

Please check

http://forum.cs-cart.com/topic/51670-alphabetical-separation-and-search-of-brands-query-help/#entry298301

function fn_yazar_ver($deger){
	$deger =urlencode($deger);
    $result = db_query("SELECT 
?:product_feature_variant_descriptions.variant,
?:product_feature_variants.variant_id
FROM ?:product_feature_variants 
INNER JOIN 
?:product_feature_variant_descriptions ON 
?:product_feature_variant_descriptions.variant_id = 
?:product_feature_variants.variant_id
WHERE ?:product_feature_variants.feature_id=2 order by ?:product_feature_variant_descriptions.variant ASC");
    return $result;
}

Thank you for your help.

Is there something wrong with this query?

function fn_yazar_ver($deger){
	$deger =urlencode($deger);
    $result = db_query("SELECT 
?:product_feature_variant_descriptions.variant,
?:product_feature_variants.variant_id
FROM ?:product_feature_variants 
INNER JOIN 
?:product_feature_variant_descriptions ON 
?:product_feature_variant_descriptions.variant_id = 
?:product_feature_variants.variant_id
WHERE ?:product_feature_variants.feature_id=2 order by ?:product_feature_variant_descriptions.variant ASC");
    return $result;
}

Thank you for your help.

Is there something wrong with this query?

deger variable is not used in the query anymore. Is that correct? Try our solution from another topic