empty set query
| From: | J. Connolly | Date: | Tue, 08 Feb 2005 18:22:56 +0000 |
| Subject: | empty set query | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-38522@lists.php.net to get a copy of this message | ||
I have a query which can result in an empty set/ no matching records. The code I have which returns a code is:
$result = mysqli_query($link, $sql);
while ($query = mysqli_fetch_array($result)){
$title = $query['title'];
$director = $query['director'];
echo "<table><tr><td>$title</td><td> $director</td></tr></table>\n";
}If the resulting query is a empty set, which variable or item to I refence as null. I already tried if (!query) and (!$title) and neither of them work. I also tried if either of them are null. I don't need someone to give me a long explanation just a small bump as to what I should be referencing. In other words, what is it that I should reference? Should I just write a code that returns number of rows and use that? Jzf