"no database selected" even with full privileges

Status
Not open for further replies.

mooseman1888

New Member
Messages
2
Reaction score
0
Points
0
I've spent hours on the forums trying to figure out how to connect successfully to my database.

The script I'm using is:

$con = mysql_connect("localhost","jasonw_****","****");
if(!$con)
{
die('Could not connect: ' .mysql_error());
}
mysql_select_db("Poll", $con);

I used MySQL Databases to give full privileges to jasonw_****, but I'm still getting the same "no database selected" error.

Thanks,
Jason
 

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63
I've spent hours on the forums trying to figure out how to connect successfully to my database.

The script I'm using is:

$con = mysql_connect("localhost","jasonw_****","****");
if(!$con)
{
die('Could not connect: ' .mysql_error());
}
mysql_select_db("Poll", $con);

I used MySQL Databases to give full privileges to jasonw_****, but I'm still getting the same "no database selected" error.

Thanks,
Jason

I appreciate that you posted the code - it's gunna make this so much easier.

Databases are also prefixed with your cpanel name; you need to mysql_select_db("jasonw_Poll",$con);

Otherwise if you and another user both had a database named Poll, it'd have no idea which to get data from :)
 

mooseman1888

New Member
Messages
2
Reaction score
0
Points
0
I did what you suggested, and it works now.

THANKS SO MUCH! I love forums and the heroes who explore them.
 
Status
Not open for further replies.
Top