Search results help
Posted: Sat May 24, 2003 2:30 pm
Hey
Wonder if anyone can help
I am have done a search page, but i am not sure what code to put to say that if there is no resultts found to put a message saying that, instead of a blank page
My code is:
I thought i would do it by putting at the end
but that does not want to work
Many thanks
Wonder if anyone can help
I am have done a search page, but i am not sure what code to put to say that if there is no resultts found to put a message saying that, instead of a blank page
My code is:
Code: Select all
<?php
$db =mysql_connect("localhost","ja", "");
mysql_select_db("ja",$db);
$sql = "SELECT * FROM anime where Anime_Name like '%$search%'" ;
$rs=mysql_query($sql,$db);
$numofrows =mysql_num_rows($rs);
?>
<?php
for ($x = 0; $x <$numofrows; $x++)
{
$row = mysql_fetch_array($rs);
if($x % 2)
{
echo "<tr bgcolor="white">\n";
}
else
{
echo "<tr bgcolor ="green">\n";
}
?>
<td bgcolor="#FFFFCC"><font size="-1"><?php echo $rowї'Anime_name']; ?></td>
<td><font size="-1"><?php echo $rowї'Ep_Start']; ?> - <font size="-1"><?php echo $rowї'EP_End']; ?></td>
<td align="center"><font size="-1"><?php echo $rowї'Language']; ?></td>
<td align="center"><font size="-1"><?php echo $rowї'Complete']; ?></td>
<td align="center"><font size="-1"><?php echo $rowї'Discs']; ?></td>
<td align="center"><font size="-1"><?php echo $rowї'Formats']; ?></td>
<td align="center"><font size="-1"><?php echo $rowї'Quality']; ?></td>
<td align="center"><font size="-1"><a href="../list/detail.php?Anime_id=<?php echo $rowї'Anime_id'];?>%20">Info</a></td>
<?php
}
?>Code: Select all
<?php
else
{
echo "Nothing found";
}
?>Many thanks