gpt4 book ai didi

来自 2-Plan 开源安装的 PHP 警告

转载 作者:行者123 更新时间:2023-11-29 19:15:09 24 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc... expects parameter 1 to be resource

(31 个回答)


5年前关闭。




我收到以下错误,想知道是否有人可以帮助我解决错误。

PHP 警告:mysql_fetch_array() 期望参数 1 是资源, bool 值在/var/www/html/2plan/include/class.user.php 第 261 行给出,引用:http://localhost/2plan/install.php?action=step3

下面是来自 class.user.php 文件的部分代码

/**
* Get a user profile
*
* @param int $id User ID
* @return array $profile Profile
*/

function getProfile($id)
{
$id = (int) $id;

$sel = mysql_query("SELECT * FROM ".$this->getTableName()." WHERE ID = $id");
$profile = mysql_fetch_array($sel);' //This is line 261

感谢是否有人可以指出我需要做些什么来纠正错误的正确方向。提前致谢。

最佳答案

确实,该代码已过时,因为您不应该使用 mysql ,而是使用 mysqlipdo Why shouldn't I use mysql_* functions in PHP? .

但如果必须,请执行以下操作以查看错误:

 if(!$sel) die("ERROR: " . mysql_error()); 

关于来自 2-Plan 开源安装的 PHP 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42775447/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com