我是 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
您能否帮助确定此示例的问题所在。
谢谢