cvs: docweb /www admin.php
[email protected] ("Nuno Lopes")
| Newsgroups | php.doc.web |
|---|---|
| Message-ID | <cvsnlopess1122656773@cvsserver> |
nlopess Fri Jul 29 13:06:13 2005 EDT
Modified files:
/docweb/www admin.php
Log:
show the warnings when executing the query to workaround a stupid libsqlite bug
http://cvs.php.net/diff.php/docweb/www/admin.php?r1=1.2&r2=1.3&ty=u
Index: docweb/www/admin.php
diff -u docweb/www/admin.php:1.2 docweb/www/admin.php:1.3
--- docweb/www/admin.php:1.2 Fri Jul 29 08:30:38 2005
+++ docweb/www/admin.php Fri Jul 29 13:06:11 2005
@@ -1,5 +1,5 @@
<?php
-/* $Id: admin.php,v 1.2 2005/07/29 12:30:38 nlopess Exp $ */
+/* $Id: admin.php,v 1.3 2005/07/29 17:06:11 nlopess Exp $ */
include '../include/init.inc.php';
require_once '../include/lib_auth.inc.php';
@@ -50,23 +50,27 @@
// execute the sql
} else {
- $idx = sqlite_open(dirname(__FILE__) . '/../sqlite/' . $_POST['file'], 0666, $error);
+ $file = dirname(__FILE__) . '/../sqlite/' . $_POST['file'];
+ $idx = sqlite_open($file, 0666, $error);
if (!$idx) {
echo "<p>$error</p>";
sql_print_textarea($_POST['command'], $_POST['file']);
return;
}
- $result = @sqlite_query($idx, $_POST['command']);
+ $result = sqlite_query($idx, $_POST['command']);
+echo sqlite_last_error($idx);
if (!$result) {
echo '<p><strong>There was an error in the query:</strong> ' . sqlite_error_string(sqlite_last_error($idx)) . '</p><p> </p>';
sql_print_textarea($_POST['command'], $_POST['file']);
return;
}
+ echo '<p>File size: ' . filesize($file) / 1024 . ' KB</p>';
echo '<p>Affected rows: ' . sqlite_changes($idx) , '</p>';
echo '<pre>' . htmlspecialchars(print_r(sqlite_fetch_all($result), true)) . '</pre>';
sqlite_close($idx);
+ sql_print_textarea($_POST['command'], $_POST['file']);
}
}