Home  >  Article  >  Backend Development  >  PHP不能连接数据库,是怎么回事,也不报错!

PHP不能连接数据库,是怎么回事,也不报错!

WBOY
WBOYOriginal
2016-06-06 20:51:221013browse

请大家看代码?

$con=mysql_connect("localhost","root","13865689");
if(!$con)
{
	die('不能连接'.mysql_error());
}
mysql_select_db("ycphar",$con);
$resualt=mysql_query("SELECT * FROM dede_admin");
while($row =mysql_fetch_array($rsualt))
{
	echo $row["id"]."".$row["userid"];
	echo "<br>";
}
mysql_close($con);

这段代码在浏览器中不显示数据也不报错,代码我怎么看都不觉得有什么问题,是什么原因呢?

回复内容:

请大家看代码?

$con=mysql_connect("localhost","root","13865689");
if(!$con)
{
	die('不能连接'.mysql_error());
}
mysql_select_db("ycphar",$con);
$resualt=mysql_query("SELECT * FROM dede_admin");
while($row =mysql_fetch_array($rsualt))
{
	echo $row["id"]."".$row["userid"];
	echo "<br>";
}
mysql_close($con);

这段代码在浏览器中不显示数据也不报错,代码我怎么看都不觉得有什么问题,是什么原因呢?

$resualt=mysql_query

mysql_fetch_array($rsualt)

$resualt 后来变成了 $rsualt

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