Query, but the statement and connection are certainly not related.

Source: Internet
Author: User
PHPcode $ shop_qu & quot; select * fromphonewherep_id $ id & quot; mysql_select_db (htc, $ conn); $ shop_re1mysql_query ($ shop_qu ); [color # FF0000] query, but the statement and connection are certainly correct.
PHP code
      $shop_qu="select * from phone where p_id=$id";    mysql_select_db('htc',$conn);    $shop_re1=mysql_query($shop_qu);    [color=#FF0000]while ($shop_re2=mysql_fetch_row($shop_re1)){[/color]    foreach ($shop_re2 as $va){    

Error
Warning: mysql_fetch_row () expects parameter 1 to be resource, boolean given in

I'm sure the connection is okay. it was previously used for debugging,

However, when the function was modified, the statement was rewritten and an error was reported,

I tried the statement after the value assignment in the database. The result is returned, but it cannot be called in php.

------ Solution --------------------
$ Shop_re1 = mysql_query ($ shop_qu) or die ("Invalid query:". mysql_error ());
Try this
------ Solution --------------------
$ Is there a value for id?
$ Shop_qu = "select * from phone where p_id = $ id ";
Echo $ shop_qu; // Print the $ shop_qu.

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.