微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – 用户拒绝访问

我已经创建了一个PHP脚本来访问我的数据库…据我所知,所有登录详细信息都是正确的但我收到此错误消息:用户’a5247024_thesps’@’10.1.1.36’访问被拒绝到数据库’maininf’

<?PHP
// Make a MysqL Connection
MysqL_connect("MysqL11.000webhost.com", "a5247024_thesps", "******") or     die(MysqL_error());
MysqL_select_db("maininf") or die(MysqL_error());

// Retrieve all the data from the "maininf" table
$result = MysqL_query("SELECT * FROM maininf")
or die(MysqL_error());  

// store the record of the "maininf" table into $row
$row = MysqL_fetch_array( $result );
// Print out the contents of the entry 

echo "Name: ".$row['PUA_Name'];


?>

有人可以帮忙吗?非常感谢.

解决方法:

您显然可能会将表名与数据库名混淆.除非你的表和数据库都被称为maininf,否则你对MysqL_select_db()的调用可能需要一个不同的字符串作为数据库的实际名称,而不是表名.

// Your database name may not be the same as your table name!
// Substitute the correct value in place of maininf here
MysqL_select_db("maininf") or die(MysqL_error());

// Retrieve all the data from the "maininf" table
$result = MysqL_query("SELECT * FROM maininf")
or die(MysqL_error());  

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐