aram Posted May 14, 2011 Share Posted May 14, 2011 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 More sharing options...
justsomeguy Posted May 14, 2011 Share Posted May 14, 2011 What is $searchkey? There's nothing there telling it to only look for numbers. Link to comment Share on other sites More sharing options...
aram Posted May 15, 2011 Author Share Posted May 15, 2011 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 More sharing options...
garevn Posted May 15, 2011 Share Posted May 15, 2011 is that in the 3rd row right? ' 'table Link to comment Share on other sites More sharing options...
aram Posted May 15, 2011 Author Share Posted May 15, 2011 is that in the 3rd row right? ' 'tableOmG that was the problem thanks why i didnt see that!!! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.