Jump to content

[RESOLVED] Using Xampp on localhost, connect to db with no password


flash gordon

Recommended Posts

Hi There,

I have [url=http://www.apachefriends.org/en/xampp.html]xampp[/url] install for windows. By default, there is no password set for the databases. The user name is "root".

What is the correct mysql_connect() command to get it to connect to the db?

I have tried
[code=php:0]
$database = "foo";
$table    = "calendar";
$username = "root";
$password = "";

mysql_connect("localhost", $username, $password) or die ("Could not connect to database");
[/code]
but it wont connect.

Thanks.
:)
Link to comment
Share on other sites

That code is completly fine flash gordon.

What error(s) do you get? POst them here in full if you get any. ALso add the mysql_error() function to the die clause. So this line:
[code=php:0]mysql_connect("localhost", $username, $password) or die ("Could not connect to database");[/code]


is like this:
[code=php:0]mysql_connect("localhost", $username, $password) or die ("Could not connect to database<br /><br />" . mysql_error());[/code]



This should now retrieve an error message from MySQL if there is an error occurring anywhere.
Link to comment
Share on other sites

Thanks guys! :)

Yea...suddenly it is working today.

I put it down for a week and came back. My error message was "Could not connect to database". My only guess is that I didn't have the mySQL running. I really have no idea, but it is all fine now.

Thanks again guys! I wish I could repay the php favor, but I'm not that great. If you ever need any ActionScript help, come on over to http://actionscript.org/forums and look me up.

Cheers.
:)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.