search Mysql help
Posted: Sat Jan 29, 2011 11:39 am
I have this script to search mysql, works perfectly,
only need a description when nothing was found, something like "the result is not found. "
please help I have not managed to solve it.
Thanks
only need a description when nothing was found, something like "the result is not found. "
please help I have not managed to solve it.
Thanks
<form action="/result.php" method="post"><b>search:</b> <input type="text" name="term" /><input type="submit" name="submit" value="Search" />
<?php
mysql_connect ("localhost", "user","pass") or die (mysql_error());
mysql_select_db ("db_name");
$term = $_POST['term'];
$sql = mysql_query("select * from radio where beschrijving like '%$term%' ORDER by titel");
while ($row = mysql_fetch_array($sql))
{
echo '<div id="rij">';
echo "<br/><a href='http://domain.com/sender/{$row['id']}/{$row['titel']}.html'><img src='{$row['img']}' title= 'Radio {$row['titel']} {$row['grad']}' border=0 ALIGN=LEFT></a>";
echo '<div id="result1">';
echo "<a href='http://domain.com/sender/{$row['id']}/{$row['titel']}.html'><b>Radio {$row['titel']}</b></a>";
echo '<br/><b>'.$row['grad'];echo '</b>';
echo '<br/>'.$row['beschrijving'];
echo '<br/>';
echo '</div>';
echo '</div>';
}
?>