Home > Backend Development > PHP Tutorial > MySQL 查询语句显示不出东西,该如何解决

MySQL 查询语句显示不出东西,该如何解决

WBOY
Release: 2016-06-13 10:15:12
Original
1284 people have browsed it

MySQL 查询语句显示不出东西
代码如下:


$conn = @mysql_connect("localhost", "root","12345678")or die("Fail to Connect to DB");
mysql_select_db("ogsa",$conn);

$sql="SELECT * FROM `event`";
$query=mysql_query($sql,$conn);

 $row=mysql_fetch_array($query);
 echo $row[2];
 
?>
 

数据库连接是正常的,名字和表也都是对的,表里是有东西的,但是就页面什么都显示不出来。 下面写的 happy倒是能显示,不知道是什么原因,望高人解答

------解决方案--------------------
少了一个PHP再开始的地方,解决了

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template