Radioactive Frog Posted December 18, 2003 Share Posted December 18, 2003 i have this query for searching one field SELECT * FROM `hotels` WHERE hotelname LIKE \'%j%\' at it works ok, but i would like to search say two more fields i thought it would be like below but that dont work please could someone point out where i am going wrong....thanks SELECT * FROM `hotels` WHERE hotelname OR hotelcountry OR hoteladdress LIKE \'%j%\' thanks Quote Link to comment Share on other sites More sharing options...
Tmic Posted December 18, 2003 Share Posted December 18, 2003 more like this: select * from hotels where \' *j%\' in (hotelname,hotelcountry,hoteladdress); Quote Link to comment Share on other sites More sharing options...
Radioactive Frog Posted December 18, 2003 Author Share Posted December 18, 2003 that doesnt show any results when i test it in phpmyqdmin Quote Link to comment Share on other sites More sharing options...
Tmic Posted December 18, 2003 Share Posted December 18, 2003 sry the second * must be % ofcourse this works on my system but I don\'t use phpadmin Quote Link to comment Share on other sites More sharing options...
Radioactive Frog Posted December 18, 2003 Author Share Posted December 18, 2003 yeah i had changed that, sorry i should have saidm but it doesnt make any difference Quote Link to comment Share on other sites More sharing options...
nabeel21 Posted December 18, 2003 Share Posted December 18, 2003 SELECT * FROM hotels WHERE hotelname LIKE \'%j%\' OR hotelcountry LIKE \'%j%\' OR hoteladdress LIKE \'%j%\' and make sure that the data in mysql table is all lowercase, cuz you are using \"j\". goodluck Quote Link to comment Share on other sites More sharing options...
Radioactive Frog Posted December 18, 2003 Author Share Posted December 18, 2003 thanks i will try it, j is only a test to see if it works i will put a \'%$search%\' there when i put it on the php page !! thanks again Quote Link to comment Share on other sites More sharing options...
Radioactive Frog Posted December 18, 2003 Author Share Posted December 18, 2003 great that works for that, but what about if i had to search variables coming in? how would i incorporate that? i have tried a couple of things but they dont work any ideas? thanks again Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.