Closed Thread
Results 1 to 3 of 3

Thread: "no database selected" even with full privileges

  1. #1
    mooseman1888 is offline x10Hosting Member mooseman1888 is an unknown quantity at this point
    Join Date
    Oct 2009
    Posts
    2

    Exclamation "no database selected" even with full privileges

    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

  2. #2
    Livewire's Avatar
    Livewire is offline Abuse Compliance Officer Livewire is a glorious beacon of lightLivewire is a glorious beacon of light
    Join Date
    Jun 2005
    Location
    Behind a keyboard.
    Posts
    8,995

    Re: "no database selected" even with full privileges

    Quote Originally Posted by mooseman1888 View Post
    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


    TOS breakers will be suspended regardless of race, creed, national origin, hair color, or favorite food. Thanks for your understanding!

  3. #3
    mooseman1888 is offline x10Hosting Member mooseman1888 is an unknown quantity at this point
    Join Date
    Oct 2009
    Posts
    2

    Re: "no database selected" even with full privileges

    I did what you suggested, and it works now.

    THANKS SO MUCH! I love forums and the heroes who explore them.

Closed Thread

Similar Threads

  1. Replies: 0
    Last Post: 12-02-2008, 03:18 AM
  2. How to create MySQL database and user
    By Jesse in forum Tutorials
    Replies: 11
    Last Post: 06-04-2008, 12:25 PM
  3. install drupal
    By abhi666 in forum Scripts & 3rd Party Apps
    Replies: 4
    Last Post: 02-18-2008, 08:05 AM
  4. PHP BB 2.0.16 Manual instalation
    By GFIV in forum Free Hosting
    Replies: 8
    Last Post: 09-14-2005, 12:40 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers