jeff5656 Posted August 12, 2010 Share Posted August 12, 2010 When I run this query to exclude records where id = $userarray['id'], $q = "SELECT * FROM users WHERE inst_id = '". $userarray['inst_id'] ."' AND id != '". $userarray['id'] ."' "; it actually ONLY returns records with $userarray['id'] as opposed to excluding them. Isn't the way to exclude them to use != ? Quote Link to comment Share on other sites More sharing options...
linus72982 Posted August 12, 2010 Share Posted August 12, 2010 I believe you have to use "NOT" instead of != within an sql query. Quote Link to comment Share on other sites More sharing options...
linus72982 Posted August 12, 2010 Share Posted August 12, 2010 Actually, I just read up on it and learned that != is viable in a query, so, nvm. Quote Link to comment Share on other sites More sharing options...
marcus Posted August 12, 2010 Share Posted August 12, 2010 $sql = "SELECT * FROM `users` WHERE `inst_id`='".$userarray['inst_id']."' AND `id`<> '".$userarray['id']."'"; 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.