samusk Posted October 27, 2007 Share Posted October 27, 2007 I have a quick search form for my site. There are three parameters: horse breed, zip code, and location. Users don't have to enter all of the information, rather 1 parameter or 2 or all. My problem is I can get the code for the zip code to work, but when I go to code in the rest of the parameters the code seems to stall. Anyone that can give a little light on this problem would be a great help. I have been working on this problem for days with no help. Once I figure out this problem I can go on to make an advanced search with many more parameters. Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/74961-multiple-search-parameters-with-mysql-queries/ Share on other sites More sharing options...
darkfreaks Posted October 27, 2007 Share Posted October 27, 2007 do a JOIN Quote Link to comment https://forums.phpfreaks.com/topic/74961-multiple-search-parameters-with-mysql-queries/#findComment-379064 Share on other sites More sharing options...
teng84 Posted October 27, 2007 Share Posted October 27, 2007 do this in your condition function($x=' ',$y=' ',$z=' '){ $query = ( sql here ) where 1=1; if ($x==' '){ $query.= "and field=cool"; } if ($y==' '){ $query.= "and field2=teng"; } if ($z==' '){ $query.= "and field3=teng84"; } return $query; } Quote Link to comment https://forums.phpfreaks.com/topic/74961-multiple-search-parameters-with-mysql-queries/#findComment-379068 Share on other sites More sharing options...
teng84 Posted October 27, 2007 Share Posted October 27, 2007 do a JOIN ??? multiple parameter not table Quote Link to comment https://forums.phpfreaks.com/topic/74961-multiple-search-parameters-with-mysql-queries/#findComment-379072 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.