Jump to content

user search


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.

Edited by Scott Milner
Link to post
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);

Edited by birbal
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...