Hi all,
I’m currently having a problem accessing my MySQL database for a site I am building through GoDaddy. I created a MySQL database using their front-end interface, as well as 2 users, each with a password. Within the database, I have created 2 simple tables, each with a few rows of data. If I navigate to the SQL section of the GoDaddy interface, I can type a simple SELECT statement that will prove I have multiple rows in each of those tables.
The problem I’m having now, is (first and foremost) that I’m a PHP newbie. I’ve created a very simple HTML page that I know functions properly on it’s own. The next thing I’ve done is write the following PHP code within my HTML (for sake of accuracy, the word “localhost” is typed exactly how it appears here, but the following 3 items within double-quote have been changed to protect the innocent.):
[php]
<?php
// Create connection
$con=mysqli_connect("localhost","userName","password","databaseNAme");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
[/php]
I have saved this file (HTML and PHP combined) as a .php file, and uploaded it to my server. I can navigate to it using my web browser, and the small amount of printed text tells me that I have navigated to the correct page. The problem is that no matter what I seem to do, I keep getting the following error printed on the page:
“Failed to connect to MySQL: Access denied for user ‘nserName’@‘localhost’ (using password: YES)”
At this point, I feel like I’ve exhausted dozens of different ways to do this, to no avail. At this point, I would welcome any suggestions any of you think might help. Sorry for the length of the post - and I know this might be something extremely simple, so I thank you all in advance.
Thanks again,
Phil