[cvs] [Wiki] changed: FAQ/Admin/Troubleshoot
Jan Schneider
jan at horde.org
Fri Feb 9 06:13:12 PST 2007
jan Fri, 09 Feb 2007 06:13:12 -0800
Modified page: http://wiki.horde.org/FAQ/Admin/Troubleshoot
New Revision: 6.27
Change log: The usefulness is questionable, but at least make this example work
@@ -180,37 +180,36 @@
The most straightforward way of testing your database is to create the Horde databases themselves; if the creation proceeds without error, then the database is probably functioning normally.
You can also use the following code, contributed by <chowes at ics.bc.ca>:
-<code type="php">
- <HTML>
- <BODY>
+<code>
+<html>
+<head><title>DB Test</title></head>
+<body>
- This is a test:
- <?php
+This is a test:<br>
+<?php
- function test() {
- if (!($db = mysql_pconnect(localhost,root,yourpassword))){ return 1; }
- if (!($imp = mysql_create_db(testdb, $db))) { return 2; }
- if (!($imp = mysql_select_db(testdb, $db))) { return 3; }
- if (!($result = mysql_db_query(testdb, "create table testtest ( test char(60))", $db)))
- { return 4; }
- if (!($result = mysql_db_query(testdb, "insert into testtest values ('hello world!')", $db)))
- { return 5; }
- if (!($result = mysql_db_query(testdb, "select * from testtest", $db)))
- { echo "$result";return 6; }
- if (mysql_num_rows($result)>0)
- echo (mysql_result($result, 0, 0));
- if (!($result = mysql_db_query(testdb, "delete from testtest", $db))) { return 7; }
- if (!($imp = mysql_drop_db(testdb, $db))) { return 8; }
- return 9;
- }
+function test()
+{
+ if (!($db = mysql_connect('localhost','root','yourpassword'))) return 1;
+ if (!mysql_query('create database testdb', $db)) return 2;
+ if (!mysql_select_db('testdb', $db)) return 3;
+ if (!mysql_db_query('testdb', 'create table testtest ( test char(60))', $db)) return 4;
+ if (!mysql_db_query('testdb', 'insert into testtest values (\'hello world!\')', $db)) return 5;
+ if (!($result = mysql_db_query('testdb', 'select * from testtest', $db))) return 6;
+ if (mysql_num_rows($result) > 0) echo mysql_result($result, 0, 0);
+ if (!mysql_db_query('testdb', 'delete from testtest', $db)) return 7;
+ if (!mysql_query('drop database testdb', $db)) return 8;
+ return 9;
+}
- $r = test();
- echo "<BR>result code = $r";
- ?>
- </BODY>
- </HTML>
+$r = test();
+echo "<br>result code = $r";
+?>
+
+</body>
+</html>
</code>
Then, load the file with your browser. It will create a database, a table, and a row; put data into the row; then delete the row, the table, and the database. If successful, the output will read
More information about the cvs
mailing list