Problems related to data query in phpmysql-it is not easy to add Where. I do not know what is wrong.

Source: Internet
Author: User
Tags php mysql
Phpmysql data query problem-it is not easy to use with Where. I do not know what is wrong $ query_CN & quot; SELECTPestcide_trade_namefrominsecticidewhereCompany_nameBayer & quot; $ q_result_CNmysql_query ); & nbs php mysql data query problems-adding Where is not useful, I do not know what is wrong
$ Query_CN = "SELECT Pestcide_trade_name from insecticide where Company_name = Bayer"; $ q_result_CN = mysql_query ($ query_CN );
While ($ each_ques_CN = mysql_fetch_row ($ q_result_CN ))
{
Print $ each_ques_CN [0];
}

If I do not add a where clause, $ query_CN = "SELECT Pestcide_trade_name from insecticide. If it is added, the following Warning will be reported

Warning: mysql_fetch_row (): supplied argument is not a valid MySQL result resource in d: \ apm_setup \ htdocs \ search. php on line 33

Line 33 is the line while ($ each_ques_CN = mysql_fetch_row ($ q_result_CN). What is this. Thank you.

------ Solution --------------------
$ Query_CN = "SELECT Pestcide_trade_name from insecticide where Company_name = 'bayer '";
------ Solution --------------------
Discussion

$ Query_CN = "SELECT Pestcide_trade_name from insecticide where Company_name = 'bayer '";

------ Solution --------------------
... Where Company_name = '$ name '";

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.