Home  >  Article  >  Backend Development  >  为什么小弟我的mysql_fetch_array()语句不能正常输出呢

为什么小弟我的mysql_fetch_array()语句不能正常输出呢

WBOY
WBOYOriginal
2016-06-13 12:49:10803browse

为什么我的mysql_fetch_array()语句不能正常输出呢?
$conn=@mysql_connect("localhost","root","") or die ("链接错误");
mysql_select_db("newdb",$conn);
$sql="SELETE * FROM test";
$query=mysql_query($sql,$conn);
$array=mysql_fetch_array($query);
print_r($array);

?>










Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\WAMP5\wamp\www\test\file.php on line 6

MySQL php
------解决方案--------------------
$sql="SELECT * FROM test";
------解决方案--------------------
supplied argument is not a valid MySQL result resource  参数不是一个MYSQL结果资源
那就是你的SQL语句执行有问题
------解决方案--------------------
SELETE * FROM test

改为
SELECT * FROM test

------解决方案--------------------
编码没有统一,你的表是什么编码就加上
mysql_query("set 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