Re: [PHP] dealing with no record
"Jacky@lilst" wrote: People If I run a sniplet like this: ** $query="select name from foo"; $result= mysql_query($query); while($row = mysql_fetch_row($result)) stuff...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? Hello, In the PHP Manual, section MySQL, there is a description of a function called mysql_num_rows()... Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] dealing with no record
People If I run a sniplet like this: ** $query="select name from foo"; $result= mysql_query($query); while($row = mysql_fetch_row($result)) stuff...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 [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself"
Re: [PHP] dealing with no record
On Tue, 6 Mar 2001 06:36, [EMAIL PROTECTED] wrote: People If I run a sniplet like this: ** $query="select name from foo"; $result= mysql_query($query); while($row = mysql_fetch_row($result)) stuff...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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]