Where am I going wrong

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
elfeste

Sat Jun 30, 2007 4:03 am

I am trying to create a search to pick out Yamaha models from a list of various manufacturers.
The user inputs the model of the equipment and the query searches for matching entries based on the two matching criteria.

However, the script below always returns an error can anyone see the problem?

$query = "select MAKE,MODEL,PRICE,REF,DISC,ID,SKU from remotes where MAKE like YAMAHA AND MODEL like \"%$trimmed%\"
order by MAKE";

$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);


TIA
User avatar
WiZARD
Moderator
Moderator
Posts: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Mon Jul 02, 2007 4:30 am

elfeste wrote:I am trying to create a search to pick out Yamaha models from a list of various manufacturers.
The user inputs the model of the equipment and the query searches for matching entries based on the two matching criteria.

However, the script below always returns an error can anyone see the problem?

$query = "select MAKE,MODEL,PRICE,REF,DISC,ID,SKU from remotes where MAKE like YAMAHA AND MODEL like "%$trimmed%"
order by MAKE";

$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);


TIA
try this:
$query = 'select MAKE,MODEL,PRICE,REF,DISC,ID,SKU from remotes where MAKE like "YAMAHA" AND MODEL like "'.$trimmed.'" order by MAKE';
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";
Image
Post Reply