display no results found

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Robert07
Forum Contributor
Posts: 113
Joined: Tue Jun 17, 2008 1:41 pm

Re: display no results found

Post by Robert07 »

Just change where you echo that parameter to wherever in the document you want. As long as it is after the parameter is defined it will work.
jonnyfortis
Forum Contributor
Posts: 462
Joined: Tue Jan 10, 2012 6:05 am

Re: display no results found

Post by jonnyfortis »

ok im sorry about this

i have now put this in the body

<?php
echo "<p>$noresults</p>";
?>

and it show all the time even if there are results

in the header we have

$results = mysql_num_rows($Recordset1);
$noresults = 'No results found';
if($results == 0) {
echo "<p>$noresults</p>";
}

if i run it without it being in the body it works fine

thanks
jonnyfortis
Forum Contributor
Posts: 462
Joined: Tue Jan 10, 2012 6:05 am

Re: display no results found

Post by jonnyfortis »

its ok i have sorted it

in the header

$results = mysql_num_rows($Recordset1);
$noresults = 'No results found';


in the body

<?php
if($results == 0) {
echo "<p>$noresults</p>";
}
?>

thank you so much for your patience

thanks again
Post Reply