Php prompts Warning: mysql

Source: Internet
Author: User
My height code is as follows: include (conn. php); if (! Empty ($ _ GET [id]) {$ sqlselect * fromnewswhere 'id '. $ _ GET [id].; $ querymysql_query ($ SQL); $ rsmysql_fetch_array ($ query);} the error Warning: mysql_fetch_array () expectsparameter1 is returned.

My height code is as follows: include ("conn. php"); if (! Empty ($ _ GET ['id']) {$ SQL = "select * from news where 'id' = '". $ _ GET ['id']. "'"; $ query = mysql_query ($ SQL); $ rs = mysql_fetch_array ($ query);} the error Warning: mysql_fetch_array () expects parameter 1 is returned.

My height code is as follows:

Include ("conn. php ");

If (! Empty ($ _ GET ['id']) {
$ SQL = "select * from news where 'id' = '". $ _ GET ['id']. "'";
$ Query = mysql_query ($ SQL );
$ Rs = mysql_fetch_array ($ query );
}

Error Message

Warning: mysql_fetch_array () expects parameter 1 to be resource, boolean given in F: xmappwww.111cn. netmylibrarysearch_result.php on line 32

Then I upgraded the code.

If (! Empty ($ _ GET ['id']) {
$ SQL = "select * from news where 'id' = '". $ _ GET ['id']. "'";
$ Query = mysql_query ($ SQL );
If (mysql_num_rows ($ query)
{
$ Rs = mysql_fetch_array ($ query );
}
Else
{
Mysql_error ();
}
}

In this way, the mysql error message is displayed. The result is that the SQL statement is faulty. Modify the SQL statement,

Http://www.111cn.net/phper/php.html

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.