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.