I've spent hours trying to make this work. No solutions from the search have helped me, so I'm finally asking.
What I'm trying to do is: Display a message if no results are found.
This is what I have, and it is currently not working to my dismay.
$sql = mysql_query("SELECT * FROM cover WHERE MATCH(keyword,description,categories) AGAINST('$search_key' in boolean mode) ORDER BY id DESC LIMIT $from , $perPage");
$i=1;
while($result = mysql_fetch_object($sql)) {
$keyword = $result->keyword;
$img = $result->img;
$description = $result->description;
if($img != null) { DO THIS;
if($i==2) { require_once(dirname(__FILE__).'/page.php'); }
$i++; }
}
if($img == null) { print "<center>No Results Found</center>"; }
I don't know how to use mysql_num_rows with this (which is what I've seen is the most popular solution around the site), it returns an error and I'm thinking it doesn't work well with mysql_fetch_object($sql) ? And I don't think this: $img = $result->img; would work with mysql_num_rows either.
I'm just trying to find a way to do this without having to modify anything inside the brackets, just the ones outside.
When I say "NOT WORKING", I mean it doesn't show the message that is supposed to show if results are not found. I've tested if($img != null) { print "<center>No Results Found</center>"; } and it works fine, it shows the message. But it doesn't seem to work the other way, and I'm now just confused.