Jump to content

connecting to database


Tylor_Famous

Recommended Posts

(Thank you for reading this!)

Ok I am still new to php and mysql and when I connect to my database I need to have something like this:

 

$dbhost = 'host';

$dbuser = 'root';

$dbpass = 'password';

$dbname = 'name';

 

Well, before when I had my database with godaddy the host was something like 123.456.78.90.secureserver.net and that worked fine. Well, I switched to a Parallels PLESK virtual server and i have to have the database there and I can't figure out what to put as the host! I tried localhost and

127.0.0.1 and even my server's ipaddress and NOTHING will work and I really need to get it working like TODAY? I need some help!

Any help you may have would be GREATLY appreciated!

Thank you in advance!

 

Here is my PHP code:

<?php
$dbhost = 'localhost';
$dbuser = 'USERNAME';
$dbpass = 'PASSWORD';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'TABLENAME';
mysql_select_db($dbname);
?> 

 

And here is my Error:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'domainname'@'localhost' (using password: YES) in C:\Inetpub\vhosts\domainname\httpdocs\test\dbtest.php on line 6

Error connecting to mysql

Link to comment
https://forums.phpfreaks.com/topic/110756-connecting-to-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.