> [snip]
> $found = 0;
> while ($mydata = mysql_fetch_object($news))
> {
> if ($mydata->StudentId == $StudentId)
> {$found = 1; break;}
> }
>
> if ($found==1){do this}else{do that}
> [/snip]
>
> Why two if's? Isn't if the student is found in the first if, don't you
> want to do stuff then? Just curious...
<late_reply>
It's so the "not found" condition can be checked and handled.. You'd still
need a second if to handle that..
eg
$found = 0;
while ($mydata = mysql_fetch_object($news))
{
if ($mydata->StudentId == $StudentId)
{do this; $found = 1; break;}
}
if (!$found){do that}
</late_reply>
Martin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php