I've been trying to create an error message to show up in place of a search that will generate no results. So far I've had no luck. I tried do while which gave me an error message and I tried changing the while statement itself to an if which messed everything up. I tried printing out $searchresults to see if the problem was there all that did was double the first result number on each page.
$sql = "SELECT song_id, title, album, writer FROM master_list WHERE MATCH(album) AGAINST('$searchwords')ORDER BY title LIMIT $start, $display";
$result = mysql_query($sql) or die (mysql_error());
$searchresults = $start + 1;
while($row = mysql_fetch_object($result)){
echo "$searchresults) ";
echo '<font size="-1">Title: '.stripslashes(htmlspecialchars($row->title)).'<br /></font>';
echo '<font size="-1">Album: '.stripslashes(htmlspecialchars($row->album)).'<br /></font>';
echo '<font size="-1">Writer: '.stripslashes(htmlspecialchars($row->writer)).'<br /></font>';
echo '<hr size="-1" />';
$searchresults++;
}
//}
//error message
if ($searchresults = 0){
echo '<font size="+1">Sorry no results found.</font>';
}