cvs: php-gtk-web /manual add-note.php

[email protected] ("Steph Fox") Thu, 13 Jul 2006 04:27:53 -0000
Newsgroups php.gtk.webmaster
Message-ID <cvssfox1152764873@cvsserver>
sfox		Thu Jul 13 04:27:53 2006 UTC

  Modified files:              
    /php-gtk-web/manual	add-note.php 
  Log:
  That should do it. Keeping debug lines in for now just in case.
  
http://cvs.php.net/viewvc.cgi/php-gtk-web/manual/add-note.php?r1=1.30&r2=1.31&diff_format=u
Index: php-gtk-web/manual/add-note.php
diff -u php-gtk-web/manual/add-note.php:1.30 php-gtk-web/manual/add-note.php:1.31
--- php-gtk-web/manual/add-note.php:1.30	Thu Jul 13 03:32:59 2006
+++ php-gtk-web/manual/add-note.php	Thu Jul 13 04:27:53 2006
@@ -82,7 +82,7 @@
 	$setid      = 0;
 	$rowid      = 0;
 	if (file_exists($last_id)) unlink($last_id);
-	if (file_exists($queuefile)) unlink($queuefile);
+	if (file_exists($queuefile) && filesize($queuefile) < 3000) unlink($queuefile);
 
 	function force_shuffle($item, &$array) {
 		if (strlen($item) < 2) {
@@ -150,11 +150,14 @@
 		$db = sqlite_open($notesfile);
 		$estimate = sqlite_single_query($db, "SELECT COUNT(*) FROM notes");
 		$setid = sqlite_query($db, "SELECT id FROM notes WHERE id > '$estimate'", SQLITE_ASSOC);
-		if (sqlite_fetch_single($setid) !== false)
-			while (sqlite_valid($setid))
+		if ($setid && sqlite_num_rows($setid) > 0)
+			while (sqlite_valid($setid)) {
 				$rowid = sqlite_fetch_single($setid);
-		else
+				echo $rowid."<br />";
+			}
+		else {
 			$rowid = $estimate;
+		}
 		file_put_contents($last_id, $rowid);
 		sqlite_close($db);
 	}