PHP edit.php脚本中的MySQL错误 - 如何解决? [英] MySQL error in PHP edit.php script -- How to fix?
问题描述
我在PHP中遇到一个警告错误,我正在为数据库创建一个edit.php脚本。当我点击并转到编辑屏幕时,它向我发出错误:警告:mysqli_num_rows()期望参数1为mysqli_result,第34行的/../edit.php中给出布尔值。第34行是代码读取
I'm getting a warning error in PHP for an edit.php script I'm creating for a database. When I click and go to the edit screen, it shoots out an error to me: Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /../edit.php on line 34. Line 34 is the code that reads
if (mysqli_num_rows($sql) > 0)
如果有人能给我一个解决这个错误的方法,我会很感激。
代码如下:
http:// pastebin.com/Lxma0Grh [ ^ ]
If anybody can give me a solution to this error, I'd appreciate it.
The code is as follows:
http://pastebin.com/Lxma0Grh[^]
推荐答案
sql)> 0)
sql) > 0)
如果有人能给我一个解决这个错误的方法,我会很感激。
代码如下:
http://pastebin.com/Lxma0Grh [ ^ ]
If anybody can give me a solution to this error, I'd appreciate it.
The code is as follows:
http://pastebin.com/Lxma0Grh[^]
显然,你的mysqli_query没有返回任何记录集,所以怀疑是WHERE子句中的
Apparently, your mysqli_query did not return any recordset, so the suspect is the
id,你错过了单引号吗?
id in the WHERE clause, were you missing a single quote?
这篇关于PHP edit.php脚本中的MySQL错误 - 如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!