PDA

View Full Version : Database Connection Issues: (Resolved)


th2mods
11-16-2007, 12:04 AM
it wont connect to my database, i dont get this. dont i need to pass word and db name not jsut the local host and "root"?
<?php
$db_link = mysql_connect("localhost", "root", "");

if (!$db_link) {

die("Could not connect: " . mysql_error());

}

mysql_select_db("carousel") or die("Could not select database");?>


EDIT i get this error
Could not connect: Access denied for user '/hosted/subs/ulm'@'64.72.116.195' (using password: YES)

with this code
<?php
$db_link = mysql_connect("mysql", "/hosted/subs/ulmb.com/y/y/yyz/public_html", "MY PASSWORD");
if (!$db_link) {
die("Could not connect: " . mysql_error());
}
mysql_select_db("carousel") or die("Could not select database");?>

UnlimitedMB
11-16-2007, 12:58 AM
Goto http://account.ulmb.com/mysql/ to get your mysql info.
You do not put a directory path in there.

It should look like
<?php
$db_link = mysql_connect("mysql", "1234_yourdatabase", "databasepassword");

if (!$db_link) {

die("Could not connect: " . mysql_error());

}

mysql_select_db("1234_yourdatabase") or die("Could not select database");?>

I moved this thread to PHP Help, this is not a programming question but a mysql installation issue.