synchro_irl Posted February 20, 2008 Share Posted February 20, 2008 hey guys im trying to get my search to work from 3 text boxes now, it worked perfectly with 2 text boxes, i.e. location and trade type, as seen fromthe screen shot which shows the webpage view, and the code that is relevant to the search. i have tried to get teh search to work with 3 textboxes, by adding the following: $search1=$_POST["search1"]; $search2=$_POST["search2"]; $search3=$_POST["search3"]; $result = mysql_query("SELECT * FROM mytable WHERE location LIKE '%$search1%' AND type LIKE '%$search2%' AND name LIKE '%$search3%' "); and heres the screen shot: is this all that is neccessary fo it to work with teh threetext boxes? the name "search3" relates to the name of the new textbox. thanks for the help guys, steve Quote Link to comment https://forums.phpfreaks.com/topic/92178-sqlphp-help/ Share on other sites More sharing options...
trq Posted February 20, 2008 Share Posted February 20, 2008 And your actual problem is? Quote Link to comment https://forums.phpfreaks.com/topic/92178-sqlphp-help/#findComment-472153 Share on other sites More sharing options...
synchro_irl Posted February 20, 2008 Author Share Posted February 20, 2008 And your actual problem is? im trying to get the search to work based ont he inputs from 3 textboxes, rather than 2 thats my problem thanks steve Quote Link to comment https://forums.phpfreaks.com/topic/92178-sqlphp-help/#findComment-472156 Share on other sites More sharing options...
fenway Posted February 20, 2008 Share Posted February 20, 2008 Do you mean AND or OR? Quote Link to comment https://forums.phpfreaks.com/topic/92178-sqlphp-help/#findComment-472169 Share on other sites More sharing options...
synchro_irl Posted February 20, 2008 Author Share Posted February 20, 2008 Do you mean AND or OR? AND Quote Link to comment https://forums.phpfreaks.com/topic/92178-sqlphp-help/#findComment-472186 Share on other sites More sharing options...
fenway Posted February 20, 2008 Share Posted February 20, 2008 If you're trying to restrict the results, then yes, what you have will work... just recognize that you shouldn't be including columns that aren't being searched. Quote Link to comment https://forums.phpfreaks.com/topic/92178-sqlphp-help/#findComment-472202 Share on other sites More sharing options...
synchro_irl Posted February 21, 2008 Author Share Posted February 21, 2008 If you're trying to restrict the results, then yes, what you have will work... just recognize that you shouldn't be including columns that aren't being searched. it doesnt work though. i dont know why it seems perfect to me any ideas? thanks steve Quote Link to comment https://forums.phpfreaks.com/topic/92178-sqlphp-help/#findComment-472566 Share on other sites More sharing options...
fenway Posted February 21, 2008 Share Posted February 21, 2008 Define "doesn't work" -- db error, strange results, etc. Quote Link to comment https://forums.phpfreaks.com/topic/92178-sqlphp-help/#findComment-472786 Share on other sites More sharing options...
aschk Posted February 21, 2008 Share Posted February 21, 2008 If you don't fill in your input boxes do you get any results at all? Quote Link to comment https://forums.phpfreaks.com/topic/92178-sqlphp-help/#findComment-472852 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.