!为什么连上MYSQL数据库连不上表格

WBOY
Release: 2016-06-23 13:51:24
Original
1161 people have browsed it

购买了空间在***.gotoftp3.com上,数据库在myhostadmin.net上。使用PHP指针连接数据库显示  myhostadmin上的数据库显示为  网站上上传conn.php 内容如下
@mysql_connect ( "localhost:3306","kingdatape","******")or die("mysql链接失败");
@mysql_select_db("php100")or die("db链接失败");
@mysql_query("set names 'gbk'");
?>显示为DB链接失败。更换表格名字nice nice1全部显示为DB链接失败。如果输入错误的用户名或密码则是mysql链接失败。自己理解应该是连上数据库连不上表格,使用navicatformysql检查数据库发现数据库表格均正常。实在想不出问题出在哪里了,跪求各位大大帮忙。


回复讨论(解决方案)

mysql_select_db  是选择数据库而不是表。看图,你的数据库应该就是kingdatape

@mysql_select_db("php100")or die("db链接失败");
改?
@mysql_select_db("kingdatape")or die("db链接失败");

然後
@mysql_connect ("localhost:3306"," ??填?用?名"," ??填?密?")or die("mysql链接失败");

谢谢各位大大!

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