【问题标题】:PEAR DB using SQLite giving unknown errorPEAR DB 使用 SQLite 给出未知错误
【发布时间】:2013-03-21 23:27:06
【问题描述】:

我是 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

请您帮忙确定这个示例的问题所在。
谢谢

【问题讨论】:

    标签: php sqlite pear


    【解决方案1】:

    使用MDB2PDO。 DB 的支持已经结束很久了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-26
      • 1970-01-01
      • 1970-01-01
      • 2022-01-20
      相关资源
      最近更新 更多