如何使用pear mdb2调试问题的原因

时间:2021-08-30 07:13:44
<?php

 include("PEAR/MDB2.php");
      $dsn = 'mysqli://root@localhost/heart_hugger';
$options = array(
    'debug' => 2,
    'result_buffering' => false,
);

$mdb2 =& MDB2::singleton($dsn, $options);
if (PEAR::isError($mdb2)) {
    die($mdb2->getMessage());
}


$table_name = 'cms';

// if left as a non array all fields of the table will be fetched using '*'
// in that case this variable can be set to true, to autodiscover the types
$result_types = "";

$mdb2->loadModule('Extended');
$res = $mdb2->extended->autoExecute($table_name, null,
                        MDB2_AUTOQUERY_SELECT, 'cmsId = '.$mdb2->quote(1, 'integer'),
                        null, true, $table_name);

if (PEAR::isError($res)) {
    die($res->getMessage());
}

$row = $res->fetchRow();
echo "value from fetchrow = ".$row[2];


$mdb2->disconnect();
?>

i am getting the following error

我收到以下错误

MDB2 Error: not supported

MDB2错误:不支持

and i have no idea what exactly is not supported. The above code is an example given by pear in MDB2 manual. can any one please suggest what i am missing ? thanks

我不知道究竟什么不支持。上面的代码是梨在MDB2手册中给出的一个例子。任何人都可以建议我缺少什么?谢谢

1 个解决方案

#1


3  

First, debug which of the die calls are echoing the message:

首先,调试哪个模具调用正在回显消息:

die('first: ' . $res->getMessage());

After that, check the extended user information:

之后,检查扩展用户信息:

die($res->getMessage() . "\n" . $res->getUserInfo());

This should give you a hint about the real problem.

这应该会给你一个关于真正问题的提示。

#1


3  

First, debug which of the die calls are echoing the message:

首先,调试哪个模具调用正在回显消息:

die('first: ' . $res->getMessage());

After that, check the extended user information:

之后,检查扩展用户信息:

die($res->getMessage() . "\n" . $res->getUserInfo());

This should give you a hint about the real problem.

这应该会给你一个关于真正问题的提示。