Re: dealing with no record

From: Date: Mon, 05 Mar 2001 07:15:03 +0000
Subject: Re: dealing with no record
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-42586@lists.php.net to get a copy of this message
On Tue, 6 Mar 2001 06:36, jacky@activelifestyle.com wrote: > > People > If I run a sniplet like this: > > ********************** > $query="select name from foo"; > $result= mysql_query($query); > while($row = mysql_fetch_row($result)) > stuffssss.......to display record found.... > ... > *********************** > what am I suppose to do if I also want the code to be able to deal with > the case that no record found and redirect user to other page? Jack $query="select name from foo"; $result= mysql_query($query); if(mysql_num_rows($result) ==0)) { redirect } else... -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#42586) next »