how do i have multiple WHERE clauses???
Posted: Wed Jun 04, 2008 11:43 pm
Heres what I have:
Obviously thats wrong as we all know... but how do I do something like that... i tried just an && without the 2nd WHERe... but that only pulled data that had both ato = usergroup and ato=0 .... i want to pull results IF ato is EITHER the usergroup OR 0, which is Global... I tried || but that still only listed 1 result... i have 2 in the database... 1 which ato is the group and 1 where its 0... so if it all works right, both should show.
heres the code i'm using to echo the results found...
let me know if thats good or not too...
Code: Select all
$announcements = mysql_query("SELECT * FROM announcements WHERE ato = $auth[userGroup] && WHERE ato = '0'") or die(mysql_error());heres the code i'm using to echo the results found...
Code: Select all
while ($announce = mysql_fetch_assoc($announcements)) {
echo "<tr>
<td width='23%' bgcolor=\"#F4F4F4\"><div align=\"center\"><em>";
if($announce['ato'] == "1") { echo "Admins"; }
if($announce['ato'] == "2") { echo "Teachers"; }
if($announce['ato'] == "3") { echo "Parents"; }
if($announce['ato'] == "4") { echo "Students"; }
if($announce['ato'] == "5") { echo "Office"; }
if($announce['ato'] == "0") { echo "Global"; }
echo "</em></div></td>
<td width=\"77%\" bgcolor=\"#F4F4FF\"><div align=\"left\"><a href='/view-announcements.php?id=".$announce['id']."' style='color:#000; text-decoration:none;'>".$announce['subject']."</a></div></td>
</tr>";
}