- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
编辑:添加了 PDO 调用。
这是实际的错误:
Notice: Object of class PDOStatement could not be converted to int in Unknown on line 0
我通常如何找出哪一行是错误/通知的正确行,因为它是NOT第 0 行
?
我尝试使用 register_tick_function 回显 file:line,但这不起作用,因为通知总是在我的总输出结束时输出。
我正在寻找一种通用的调试方法,因为我在该对象的类中找不到任何错误。
// PHP PDO Standard
$db_server = 'mysql:host='.$this->db_host.';dbname='.$this->db_dbase;
try {
$this->db_connection = new PDO($db_server, $this->db_user, $this->db_pass);
$pdo_set = $this->db_connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, FALSE);
$pdo_set = $this->db_connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo_set = $this->db_connection->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
//DebugPrint($pdo_set, '$pdo_set');
} catch (PDOException $e) {
//print 'Error!: '.$e->getMessage().'<br/>';
die();
}
最佳答案
最后,我找到了我自己的问题的答案:
// doing PDO-sql, inserting session data, I ran into my problem.
$this->db_connection = new PDO(...);
$sql_query = "INSERT INTO ".$this->session_db_table." (...) VALUES (...)";
$sql_result = $this->db_connection->query($sql_query);
// This is the line (ideally named "0") from the notice:
return $sql_result;
return $sql_result
抛出这个通知:
“注意:类 PDOStatement 的对象无法在第 0 行的 Unknown 中转换为 int”
$sql_result
是一个对象
;预期的返回格式似乎是 boolean
。
所以我删除了这个return
,通知现在消失了。
关于php - 注意 : . .. Unknown on line 0 - How to find correct line, it's NOT "line 0",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9076899/
我正在运行PHP脚本,并继续收到如下错误: 注意:未定义的变量:第10行的C:\ wamp \ www \ mypath \ index.php中的my_variable_name 注意
我正在运行PHP脚本,并继续收到如下错误: 注意:未定义的变量:第10行的C:\ wamp \ www \ mypath \ index.php中的my_variable_name 注意
我正在运行PHP脚本,并继续收到如下错误: 注意:未定义的变量:第10行的C:\ wamp \ www \ mypath \ index.php中的my_variable_name 注意
我正在运行一个PHP脚本,并且继续收到如下错误:。第10行和第11行如下所示:。这些错误消息的含义是什么?。为什么他们突然出现了?我多年来一直使用这个脚本,从来没有遇到过任何问题。。我该怎么修理它们呢
当我在 flutter clean 之后运行 flutter run 或 debug my code 时显示此错误 Note: C:\src\flutter.pub-cache\hosted\pub.
My Goal: To fix this error and be able to run my app without an error. Error Message: Note:D:\Learni
前言:今天在解决一个问题时,程序总是不能输出正确值,分析逻辑思路没问题后,发现原来是由于函数传递导致了这个情况。 LeetCode 113 问题:给你二叉树的根节点
我正在 R 中开发一个包,当我运行时 devtools::check()我收到以下说明。 checking DESCRIPTION meta-information ... NOTE Malforme
获得通知和警告波纹管 Notice: Use of undefined constant GLOB_BRACE - assumed 'GLOB_BRACE' in /var/www/html/open
我正在准备一个 R 包以提交给 CRAN。 R CMD 检查给了我以下注意: Foreign function calls to a different package: .Fortran("cinc
我正在尝试从以下位置获取数据: http://api.convoytrucking.net/api.php?api_key=public&show=player&player_name=Mick_Gi
我有这段代码,但我不明白为什么我仍然有这个错误,我已经尝试了所有解决方案,但无法解决这个问题:-注意:未定义索引:product_price-注意:未定义索引:product_quantity-注意:
This question already has answers here: “Notice: Undefined variable”, “Notice: Undefined index”, and
我正在尝试从以下位置获取数据: http://api.convoytrucking.net/api.php?api_key=public&show=player&player_name=Mick_Gi
切记,在PHP 7中不要做的10件事 1. 不要使用 mysql_ 函数 这一天终于来了,从此你不仅仅“不应该”使用mysql_函数。PHP 7 已经把它们从核心中全部移除了,也就是说你需要迁移
前几天安装了dedecms系统,当在后台安全退出的时候,后台出现空白,先前只分析其他功能去了,也没太注意安全,看了一下安全退出的代码,是这样写的: 复制代码 代码如下: function ex
我使用此代码来检查变量$n0、$n1、$n2是否未定义。 但每次未定义时我都会收到通知。我的代码是一种不好的做法吗?还有什么替代方案吗?或者只是删除通知,代码就可以了? if
编写代码时处理所有警告是否重要?在我公司中具有较高资历的开发人员坚持认为警告是无害的。诚然,其中一些是: Warning: Division by zero Notice: Undefined ind
我有一个搜索查询,执行搜索查询后,我将$ result放入数组中。 我的PHP代码- $contents = $client->search($params); // executing the se
This question already has answers here: “Notice: Undefined variable”, “Notice: Undefined index”, and
我是一名优秀的程序员,十分优秀!