Hi, > $found =3D 0; > while ($mydata =3D mysql_fetch_object($news)) > { > if ($mydata->StudentId =3D=3D $StudentId) > {$found =3D 1; break;} > } > > if ($found=3D=3D1){do this}else{do that}
Why not re-oganise your SQL statement so it only returns the required data ?. "select * from table where StudentID = $StudentID"; if (mysql_num_rows() == 1) do this; else do that; Vic 20's were for wimps ;-) TTFN Dave mail/php/2003-08-15.tx [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] +----------------------------------------------------------------------------+ | Dave Restall, IIRC Limited, PO Box 46, Skelton, Cleveland, TS12 2GT. | | Tel. +44 (0) 1287 639309 Mob. +44 (0) 7973 831245 Fax. +44 (0) 1287 635955 | | email : [EMAIL PROTECTED] [EMAIL PROTECTED] Web : http://www.iirc.net | +----------------------------------------------------------------------------+ | I owe the public nothing. | | -- J.P. Morgan | +----------------------------------------------------------------------------+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php