Page 1 of 1

conditional user feedback

Posted: Sat Feb 28, 2004 12:07 pm
by cauri
new to php mysql

When a database query returns no results, what is the best way to use php to redirect to another page or to display "nothing found" instead of the results?

cauri
[/google]

Posted: Sat Feb 28, 2004 1:01 pm
by Weirdan

Code: Select all

$res=mysql_query("SELECT something FROM something_else");
if(mysql_num_rows($res)<1)
   echo "<span style='color: red; text-align:center'>Sorry, nothing found ;(</span>";
else {
  //display your results here
}
:D