RE: [PHP] If you ever had a Vic20

From: Date: Fri, 15 Aug 2003 11:41:21 +0000
Subject: RE: [PHP] If you ever had a Vic20
Groups: php.general 
Request: Send a blank email to php-general+get-159674@lists.php.net to get a copy of this message
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 jt.johnston@usherbrooke.ca martin.towell@world.net php-general@lists.php.net jay.blanchard@niicommunications.com +----------------------------------------------------------------------------+ | 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 : dave@iirc.net dave@restall.net Web : http://www.iirc.net | +----------------------------------------------------------------------------+ | I owe the public nothing. | | -- J.P. Morgan | +----------------------------------------------------------------------------+

« previous php.general (#159674) next »