---恢复内容开始---

今天往php里写了一条sql查询,

$sql = "select * from videos where vuser=".$u;

$ret = mysql_query($sql,$con);

while($row = mysql_fetch_array($ret))『』

然后运行时在while语句处卡住了,最后检查nginx的error.log,提示是这样的"[error] 16246#0: *28 FastCGI sent in stderr: "PHP Warning:  mysql_fetch_array() expects parameter 1 to be resource, boolean given in /usr/local/openresty/nginx/html/list.php on line 14" while reading response header from upstream"

后来发现原来是$sql出现了问题,查询varchar类型语句后面不能直接接.$变量,$变量在php里不是一个字符串类型.

 

 

最后改成了$sql = "select * from videos where vuser='".$u."'";,程序运行通过。

---恢复内容结束---

相关文章:

  • 2022-01-26
  • 2021-07-09
  • 2022-02-09
  • 2022-12-23
  • 2021-11-11
  • 2021-11-21
  • 2022-12-23
猜你喜欢
  • 2021-06-23
  • 2021-05-16
  • 2021-12-24
  • 2021-07-25
  • 2021-12-18
  • 2021-10-01
  • 2021-08-10
相关资源
相似解决方案