php expects parameter 1 to be resource, array given error_PHP Tutorial

WBOY
Release: 2016-07-21 15:31:26
Original
810 people have browsed it

If you are using a packaged class
for example
function fetch_array($query, $result_type = MYSQL_ASSOC) {
return mysql_fetch_array($query, $result_type);
}
[/ code]
This error will be reported
This is because the $query you pass is a Boolean value, and the parameters in mysql_fetch_array require resource types. This is because your program will determine that the parameters you pass are wrong. ,
We can

Copy code The code is as follows:

function fetch_array($query, $result_type = MYSQL_ASSOC) {
return @mysql_fetch_array($query, $result_type);
}

Use @ in front to suppress error prompts, or
try the interpretation statement to execute this statement,
Copy code The code is as follows:

if (this parameter)
{
Execute
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323052.htmlTechArticleIf you are using a packaged class such as function fetch_array($query, $result_type = MYSQL_ASSOC) { return mysql_fetch_array ($query, $result_type); } [/code] will report this error...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!