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

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

WBOY
Release: 2016-06-06 20:51:22
Original
1053 people have browsed it

请大家看代码?

$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);
Copy after login
Copy after login

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

回复内容:

请大家看代码?

$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);
Copy after login
Copy after login

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

$resualt=mysql_query

mysql_fetch_array($rsualt)

$resualt 后来变成了 $rsualt

Related labels:
php
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