sqlite if query changes to empty on a loop
| From: | chris at aquanuke dot com | Date: | Thu, 10 May 2007 19:55:19 +0000 |
| Subject: | sqlite if query changes to empty on a loop | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-254758@lists.php.net to get a copy of this message | ||
Hello,
I have a loop on an sqlite query which checks $domain until the status of $domain changes and then it deletes $domain.
However when all the $domain items have been deleted I need the script to stop.. regardless of how many querys the loop
still has to run. So I want to detect when its empty and then stop.
I have this... which does not work.
<?
$db = sqlite_open("whois.sqlite");
$x = 0;
while ($x < 9000) {
$result = sqlite_query($db, "SELECT * FROM whois ORDER BY id");
// if (!$result) {
if (empty($result)) {
echo "No data";
} else {
while ($row = sqlite_fetch_array($result)) {
$domain = $row['name'];
echo "$domain";
$x++;
usleep(400000);
}
}
}
sqlite_close($db);
?>
Thanks
Chris