i am building some thing that will grab part numbers and description
from a data base works great when you type in part of a word or part of the part number the issue i run into is when i type in the full part number for example A11-123 this does not bring back any data a push in the right direction would be greatly appreciated

$query = "SELECT * FROM products WHERE `prod` LIKE '%$looky%' OR `desc` LIKE '%$looky%'";

Recommended Answers

All 4 Replies

As always make sure that $looky is what you think it is by var_dump ing it. Also, manually look in the database to make sure that record is actually there.

yea the var is correct and the data is in the database im sure of that
also if i search for A11 it does come up and if i search for 123 it does come up but if i do search for A11-123 it does not come up same thing if i do A11 123 nothing shows up

If 'desc' is a FULLTEXT field instead of a VARCHAR field then you have to use MATCH <field> AGAINST ('<string>') instead of LIKE IIRC

for some reason i over looked something thing but when i set the variables to zero so they had a starting of 0 it worked fine thats for the reply shawn

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.