首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何用pear mdb2调试问题的原因

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

Stack Overflow用户
提问于 2011-06-04 07:10:02
回答 1查看 4K关注 0票数 2
代码语言:javascript
复制
<?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();
?>

我收到以下错误

MDB2错误:不支持

我不知道什么是不被支持的。以上代码是pear在MDB2手册中给出的一个例子。有谁能告诉我我错过了什么吗?谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-06-06 13:58:33

首先,调试哪个模块调用回显消息:

代码语言:javascript
复制
die('first: ' . $res->getMessage());

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

代码语言:javascript
复制
die($res->getMessage() . "\n" . $res->getUserInfo());

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

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6235351

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档