Ik heb mijn query werkend gemaakt op zoeken van barcode en naam.
Nu Duurt het zeker +-10 seconden voor er resultaat komt.
En bij zoeken op barcode (product_model) laat hij het product 2x zien.
bij zoeken op naam laat hij hem 100x zien.
Kan iemand mij wijzen of ik iets fout doe ?
<?
if(isset($_POST['item_search']) and $_POST['item_search']!='')
{
$search=$_POST['item_search'];
$_SESSION['current_item_search']=$search;
$query="SELECT p.products_id,p.products_model,pd.products_name,p.products_price,tr.tax_rate
FROM
products as p,products_description as pd,tax_rates as tr,tax_class as tc
WHERE
p.products_id=pd.products_id and
p.products_tax_class_id=tc.tax_class_id and
tr.tax_class_id=tc.tax_class_id and
p.products_model like \"%$search%\" or
pd.products_name like \"%$search%\"
and pd.language_id=1
ORDER
by pd.products_name"; }
elseif(isset($_SESSION['current_item_search']))
{
$search=$_SESSION['current_item_search'];
$query="SELECT p.products_id,p.products_model,pd.products_name,p.products_price,tr.tax_rate
FROM
products as p,products_description as pd,tax_rates as tr,tax_class as tc
WHERE
p.products_id=pd.products_id and
p.products_tax_class_id=tc.tax_class_id and
tr.tax_class_id=tc.tax_class_id and
p.products_model like \"%$search%\" or
pd.products_name like \"%$search%\"
and pd.language_id=1
ORDER
by products_description.products_name";
}
else
{
$query="SELECT p.products_id,p.products_model,pd.products_name,p.products_price,tr.tax_rate
FROM
products as p,products_description as pd,tax_rates as tr,tax_class as tc
WHERE
p.products_id=pd.products_id and
p.products_tax_class_id=tc.tax_class_id and
tr.tax_class_id=tc.tax_class_id and pd.language_id=1 ORDER
by pd.products_name";
}
?>
1.095 views