RE: empty set query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
To: PHP list <php-db@xxxxxxxxxxxxx>
Subject:  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


-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux