Jump to content

user search


sooty2006

Recommended Posts

i have placed on my online website a search for playersthis only works for usernames onlymy form consists of textbox usernameselect genderselect statusselect levelselect groupif a user selects all 4 select boxes it does't display anythingmy mysql statementmysql_query("SELECT * FROM `users` WHERE `username` LIKE '%$_POST[username]%' AND `gender` = '$_POST[gender]' AND `status` = '$_POST[status]' AND `level` = '$_POST[status]' AND `group` = '$_POST[group]'");if a user does't select a select box it will not search for it in the query!what i need is how to do this so it works selecting all the boxes i dont think the mysql statement can handle this much!any ideas? cheers.

Link to comment
Share on other sites

$_POST[name] should be like $_POST['name']

if a user selects all 4 select boxes it does't display anything
what do you mean by that? is the query failing? or it is giving empty result set?
if a user does't select a select box it will not search for it in the query!
you can do it something like...
$qry="SELECT * FROM `users` WHERE `username` LIKE '%$_POST[username]%'"if(isset($_POST['status']);$qry=$qry."AND `status` = '$_POST[status]'";//so on..with your other fieldmysql_query($qry);

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...