doulei6330
doulei6330
2012-09-08 20:31

关于我的php网站和mysql连接我真的很困惑和沮丧

已采纳

So basically I've created a MYSQL database that holds information about a gaming server player information, it's loaded into this PHP website that I created just 2 days ago (I'm completely new to PHP, I only started experimenting on it 2 days ago). So I had it all fixed up but on a localhost, it could fetch the data from the mysql database but only in the localhost, today I wanted to host a free mysql hostname is: fdb3.runhosting.com username: 1141497_damagedz and ofcourse I know the password. But when I'm trying to type this in via my PHP code in the db_connect line it gives me error saying it fails to connect at line 13 which is the line of $db_connect line, before it did work under the localhost but just now it doesnt work because I've deleted 3 files from xampp but surely that shouldnt matter now since its hosted on a whole different place like fdb3.runhosting.com ??

Also I'm using Adobe Dreamweaver to make the PHP website, before I just had to type in

http://localhost/tester.php 

to open up my tester.php website that I've been working on, but now after I deleted the xampp it wont open this so I can't really tell what I'm doing or does it work or not, this is after I deleted my xampp, which is after I deleted my 3 files from xampp. So you can see i'm really confused and I do not know how to fix this at all, I don't know why db_connect at php gives me errors when clearly my fdb3.runhosting.com mysql database works just fine... I've created tables there too. Also how may I run my tester.php file without the localhost? Please tell me I'm really confused and really need help, thank you!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • doupai5450 doupai5450 9年前

    "I've deleted 3 files from xampp but surely that shouldnt matter"

    Which 3 files and how do you come to that conclusion? Everything you say tends to indicate the reverse to be true!

    Re-install XAMPP is the logical first option. Backup your htdocs folder then re-install. Don't know if you'll need the backup or not (I suspect not)

    点赞 评论 复制链接分享
  • douluchuo0801 douluchuo0801 9年前

    I agree with David.

    It is highly unlikely you can use the remote database at fdb3.runhosting.com using PHP scripts on your local computer. XAMPP includes a MySQL database server and had you not deleted phpMyAdmin you would be able to use that to browse the databases on it.

    Develop the website on your local XAMPP install and local XAMPP database, then export the database to the remote host and copy the files across when you are ready to view it online.

    It's also worth keeping the XAMPP install folder and others because it contains information on XAMP and I believe allows you to check whether the version you're running is the latest one.

    点赞 评论 复制链接分享

相关推荐