0

私は 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

この例の問題点を特定するのを手伝っていただけませんか。
ありがとう

4

1 に答える 1

-1

MDB2またはPDOを使用します。DB のサポートはかなり前に終了しました。

于 2013-03-21T15:27:06.837 に答える