RE: [PHP-DB] empty set query

From: Date: Tue, 08 Feb 2005 18:32:49 +0000
Subject: RE: [PHP-DB] empty set query
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-38523@lists.php.net to get a copy of this message
Every var should be set at the beggining of the script $title = ''; $director = ''; then if there is no result, already has a value bastien
From: "J. Connolly" <web@jozef.info> To: PHP list <php-db@lists.php.net> Subject: [PHP-DB] empty set query Date: Tue, 08 Feb 2005 13:22:56 -0500 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.db (#38523) next »