No database selected...?

Mariodont

New Member
Messages
3
Reaction score
0
Points
0
So I put up some php files on my server, and whenever I try to look at one of them on the site I get the message "No database selected". I clearly labeled my SQL database in the file itself, so I don't really know what the problem is. I think it must be my db_host, for this I put localhost, but I figure it must be something else.Anyone know what it is, then? And if this isn't my problem, does anyone know what my problem is/how I can fix it?

Thanks in advance.
 

Synkc

Active Member
Messages
1,765
Reaction score
0
Points
36
If your MySQL Database is hosted on your x10Hosting account then yes, 'localhost' should be correct.

After using the mysql_connect() function, did you specify a mysql_select_db(databasename) function? If that is not the problem, do you mine posting the content of one of your php files?
 

Mariodont

New Member
Messages
3
Reaction score
0
Points
0
<?php
$db_host = "localhost";
$db_user = "DATABASE USERNAME GOES HERE";
$db_pwd = "DATABASE PASSWORD GOES HERE";
$db_name = "DATABASE NAME GOES HERE";
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);
?>

Thats my thingy.
 
Last edited:

nightscream

New Member
Messages
948
Reaction score
0
Points
0
can you give us some more code? and are you sure you have the database set up correctly?
 
Top