Home  >  Article  >  Backend Development  >  这段代码哪里有问题

这段代码哪里有问题

WBOY
WBOYOriginal
2016-06-23 13:39:26972browse

$sqlq=$empire->query("SELECT infotags,id FROM hd_ecms_shop_data_1 WHERE hd_ecms_shop_data_1.infotags LIKE '%亲爱的%'");
$result=$empire->fetch($sqlq);
    //print_r($result);//这一步能打印出值来
if($empire->num($result))
    foreach($result as $value){
        if(isset($result['id']))
            $idStr.=$result[id].',';
    };
    $idStr=rtrim($idStr,',');
    echo $idStr;exit;
?>
错误提示: Warning:  mysql_query() expects parameter 1 to be string, array given in D:\WWW\dgcms\e\class\db_sql.php on line 15

上面这段代码,不知哪里有问题呢


回复讨论(解决方案)

你把这个语句到MySQL执行一下看看是否正确

错误提示你在调用$empire->query()方法查询sql语句的时候,有一个warning,你输入到mysql_query()的不是字符串而是数组。。。。
这个错误应该发生在 生成$empire 这个对象的类里面,这里的代码看不出来

Statement:
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