严格标准:资源ID#73作为偏移量,转换为整数 [英] Strict Standards: Resource ID#73 used as offset, casting to integer
本文介绍了严格标准:资源ID#73作为偏移量,转换为整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用此PHP函数获取MySql结果:
i fetch MySql result using this PHP function:
function fetcharray ($query_id)
{
if(!$query_id)
{
$query_id = $this->query_res;
}
if($query_id)
{
$this->q_array[$query_id] = @mysql_fetch_array($query_id,MYSQL_ASSOC); // LINE 124
return $this->q_array[$query_id]; //LINE 125
}
else
{
return false;
}
}
现在,我转到PHP 5.5,然后看到此错误:
Now, I move to PHP 5.5 and see This error:
Strict Standards: Resource ID#73 used as offset, casting to integer (73) in domain.com/includes/functions/db.php on line 124
Strict Standards: Resource ID#73 used as offset, casting to integer (73) in domain.com/includes/functions/db.php on line 125
如何解决此错误?
推荐答案
您正在使用资源,它是 not 整数.即使在检查时看到一个数字,它实际上也不是真正的整数.这是与您的MySQL连接关联的资源ID.
You're using a resource, which is not an integer, as an integer. Even though you see a number when you inspect it, it actually is not a true integer. It's a resource ID that is associated with your MySQL connection.
如果您想将其用作整数,我认为,则可以在使用它之前将其转换为整数(我从未尝试过).
If you want to use it as an integer I think you can cast it to an integer before using it (I never actually tried it).
if($query_id)
{
$id = (int) $query_id;
$this->q_array[$id] = @mysql_fetch_array($query_id,MYSQL_ASSOC); // LINE 124
return $this->q_array[$id]; //LINE 125
}
这篇关于严格标准:资源ID#73作为偏移量,转换为整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文