Forums

PHP

This topic is locked

search problem

Posted 03 Feb 2003 01:18:29
1
has voted
03 Feb 2003 01:18:29 Dan Schultz posted:
Hi,

I'm having a problem with this search feature. For instance: go to www.intriguemedia.net/lewismotors/inventory/searchVehicle.php and do a search on "honda". Instead of just bringing up Honda vehicles, it brings up all the vehicles in the database.

Here's my query statement:

SELECT *
FROM vehicles
WHERE model LIKE 'varModel%' OR vehicles.make LIKE 'varMake%' AND vehicles.`year` = 'varYear'
ORDER BY ID ASC

some help would greatly be appreciated.

Dan
www.intriguemedia.net

Replies

Replied 03 Feb 2003 12:17:35
03 Feb 2003 12:17:35 Juergen Langenberg replied:
<font face='Tahoma'>
SELECT *
FROM vehicles
WHERE model LIKE '<b>%varModel%</b>' OR vehicles.make LIKE '<b>%varMake%</b>' AND vehicles.`year` = 'varYear'
ORDER BY ID ASC

Goog luck,
jogi
</font id='Tahoma'>
Replied 03 Feb 2003 17:23:55
03 Feb 2003 17:23:55 Julio Taylor replied:
what did you do different?!

------------------------
Julio

PHP | MySQL | DWMX | ColdFusion

ICQ: 19735247
Replied 03 Feb 2003 18:33:03
03 Feb 2003 18:33:03 Brent Colflesh replied:
Dear Dan,

WHERE (model LIKE 'varModel%' OR vehicles.make LIKE 'varMake%') AND vehicles.`year` = 'varYear'

Note the addition of the parenthesis.

Regards,
Brent

Reply to this topic