Where is the code?-php Tutorial

Source: Internet
Author: User
Where is the problem with this code? $ Sqlq = $ empire-> query ("SELECT infotags, id FROM hd_ecms_shop_data_1 WHERE hd_ecms_shop_data_1.infotags LIKE '% dear % '");
$ Result = $ empire-> fetch ($ sqlq );
// Print_r ($ result); // you can print the value in this step.
If ($ empire-> num ($ result ))
Foreach ($ result as $ value ){
If (isset ($ result ['id'])
$ IdStr. = $ result [id]. ',';
};
$ IdStr = rtrim ($ idStr ,',');
Echo $ idStr; exit;
?>
Error message: Warning: mysql_query () expects parameter 1 to be string, array given in D: \ WWW \ dgcms \ e \ class \ db_ SQL .php on line 15

I don't know where the above code is wrong.


Reply to discussion (solution)

Run this statement in MySQL to check whether the statement is correct.

The error message is that when you call the $ empire-> query () method to query SQL statements, there is a warning. what you input to mysql_query () is not a string but an array ....
This error should occur in the class that generates the $ empire object. the code here cannot be seen.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.