queries with exceptions?
Posted: Thu Aug 21, 2003 5:09 am
I want to do a query to pull out all users except the current user. I've looked on mysql.com and can't find a command that does it.
My query is :
as you can see i'm populating a form field with users to choose as a mail recipitent , i want it to show all apart from current user. something in the where clause maybe?
My query is :
Code: Select all
<?php
echo '<p class="main">Send a message.</p>';
$grabusers = "SELECT username FROM users WHERE groupname='$_SESSION[groupname]'";
$grabq = mysql_query($grabusers, $db_conn) or die("Query grabusers failed".mysql_error());
echo '<p class="main">';
echo '<table class="main" cellspacing="5" cellpadding="5" border="0">';
echo '<form method="post" action="index.php?page=e-new">';
echo '<tr><td><b>Recipitent:</b></td>';
echo '<td><select name="recip" id="recip" class="form">';
echo '<option value="blank">-select a user-</option>';
while ($grow = mysql_fetch_assoc($grabq))
{
echo '<option value="'.$grow['username'].'">'.$grow['username'].'</option>';
}
echo '</select></td></tr>';
?>