我是PEAR DB和SQLite的新手。
我正在http://www.codewalkers.com/c/a/Database-Articles/PEARSQLite-The-Lightweight-Alternative/4/
上提供示例代码这是我的代码
<?php
require_once('DB.php');
require_once "DB/sqlite.php";
$dsn = "sqlite:////./mydb.db";
$db = new DB_sqlite();
$connection = $db->connect($dsn);
if ($db->isError($connection)){
die("Could not connect to the database: <br />".$db->errorMessage($connection));
}
else
echo "Connected ";
$query = "SELECT * FROM books NATURAL JOIN authors";
$result = $db->simpleQuery($query);
if ($db->isError($result)){
die("Could not query the database:<br />$query ".$db->errorMessage($result));
}
echo('<table border="1">');
echo '<tr><th>Title</th><th>Author</th><th>Pages</th></tr>';
while ($result_row = $result->fetchRow()) {
echo "<tr><td>";
echo $result_row[1] . '</td><td>';
echo $result_row[4] . '</td><td>';
echo $result_row[2] . '</td></tr>';
}
echo("</table>");
$connection->disconnect();
?>
并且在执行此操作时我遇到了错误...
Connected
Strict Standards: Non-static method DB::isManip() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\DB\common.php on line 2200
Strict Standards: Non-static method DB::errorMessage() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\DB.php on line 965
Strict Standards: Non-static method DB::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\DB.php on line 688
Strict Standards: Non-static method DB::errorMessage() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\DB\common.php on line 1963
Warning: Illegal offset type in C:\xampp\php\PEAR\DB\common.php on line 1963
Strict Standards: Non-static method DB::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\DB.php on line 688
Could not query the database:
SELECT * FROM books NATURAL JOIN authors unknown error
您能否帮助确定此示例的问题。
谢谢