Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with LIKE statement

Status
Not open for further replies.

paulbradley

Programmer
Oct 9, 2002
158
GB
I have a search box which users can enter a phrase and it searches for items LIKE what they enetered, using the following command:

SELECT product_name FROM products WHERE product_name LIKE '$searchitem' ORDER BY end_time

But this only seems to return items identical to product_name. Any ideas? Thanks in advance.
 
change it to

Code:
SELECT product_name FROM products WHERE product_name LIKE '%$searchitem%' ORDER BY end_time

gry online
 
No luck I'm afraid - just the same result.

Thanks for your help so far.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top