Hi,
Do you see any thing wrong with the following.
I was suggested to use the follwing SQL.
No matter what values I have for the variables all the records get picked.. instead of picking no record
****************
$search_image= "junk";
$search_brand="junk";
$result1= mysql_query("SELECT product_id, model,retail_price,product_image_small FROM products WHERE brand = COALESCE(@search_brand, brand) AND product_image_small = COALESCE(@search_image, product_image_small) " )
or die("Couldn't execute query: " . mysql_error());
****************************
I tried following too, that produced the same results
$search_image= "junk";
$search_brand="junk";
$result1= mysql_query("SELECT product_id, model,retail_price,product_image_small FROM products WHERE brand = COALESCE(@'$search_brand', brand) AND product_image_small = COALESCE(@'$search_image', product_image_small) " )
or die("Couldn't execute query: " . mysql_error());
Thanks
Do you see any thing wrong with the following.
I was suggested to use the follwing SQL.
No matter what values I have for the variables all the records get picked.. instead of picking no record
****************
$search_image= "junk";
$search_brand="junk";
$result1= mysql_query("SELECT product_id, model,retail_price,product_image_small FROM products WHERE brand = COALESCE(@search_brand, brand) AND product_image_small = COALESCE(@search_image, product_image_small) " )
or die("Couldn't execute query: " . mysql_error());
****************************
I tried following too, that produced the same results
$search_image= "junk";
$search_brand="junk";
$result1= mysql_query("SELECT product_id, model,retail_price,product_image_small FROM products WHERE brand = COALESCE(@'$search_brand', brand) AND product_image_small = COALESCE(@'$search_image', product_image_small) " )
or die("Couldn't execute query: " . mysql_error());
Thanks