Jump to content

Search query problem


aram
 Share

Recommended Posts

Hi i have this code for making a search in my tables but it only gets those searches that contain numbers, my problem is i want to get string searches too.

$sql = "(SELECT *,'kurdi' AS `table` FROM kurdihewal WHERE title LIKE '%" . $searchkey .  "%' OR id LIKE '%" . $searchkey ."%') UNION ALL(SELECT *,'iraq' AS `table` FROM iraqhewal WHERE title LIKE '%" . $searchkey .  "%' OR id LIKE '%" . $searchkey ."%') UNION ALL(SELECT *,'cihan' AS ``table FROM cihanhewal WHERE title LIKE '%" . $searchkey .  "%' OR id LIKE '%" . $searchkey ."%')ORDER BY id DESC LIMIT $start, $limit";

Link to comment
Share on other sites

What is $searchkey? There's nothing there telling it to only look for numbers.
$searchkey=serach words tha the user searchs for its a variable for the words that enters from the search form.you mean there is nothing wrong in this code?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...