Home  >  Article  >  Backend Development  >  php mysql 查询数据的有关问题-加下Where就不好用,不知哪有错

php mysql 查询数据的有关问题-加下Where就不好用,不知哪有错

WBOY
WBOYOriginal
2016-06-13 10:32:58876browse

php mysql 查询数据的问题-加上Where就不好用,不知哪有错
$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];
  }

上述代码 如果我不加 where的话 $query_CN = "SELECT Pestcide_trade_name from insecticide";就好使。如果加上了就会报以下的Warning

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 就是 while($each_ques_CN = mysql_fetch_row($q_result_CN)) 这一行,请问这是怎么一回事。先谢谢大家。

------解决方案--------------------
$query_CN = "SELECT Pestcide_trade_name from insecticide where Company_name='Bayer'";
------解决方案--------------------

探讨

$query_CN = "SELECT Pestcide_trade_name from insecticide where Company_name='Bayer'";

------解决方案--------------------
... where Company_name='$name'";
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn