+ Reply to Thread
Results 1 to 5 of 5

Thread: No database selected...?

  1. #1
    Mariodont is offline x10Hosting Member Mariodont is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    3

    No database selected...?

    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.

  2. #2
    Synkc's Avatar
    Synkc is offline Lord Of The Keys Synkc is an unknown quantity at this point
    Join Date
    Jun 2007
    Location
    Hervey Bay, Australia
    Posts
    1,765

    Re: No database selected...?

    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?
    E-mail: synkc[at]x10hosting[dot]com
    Hirokima.com

  3. #3
    Mariodont is offline x10Hosting Member Mariodont is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    3

    Re: No database selected...?

    <?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 by Mariodont; 11-29-2007 at 05:18 PM.

  4. #4
    Mariodont is offline x10Hosting Member Mariodont is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    3

    Re: No database selected...?

    anyone know the problem?

  5. #5
    nightscream is offline x10 Lieutenant nightscream is an unknown quantity at this point
    Join Date
    Feb 2006
    Location
    Hallaar, Belgium
    Posts
    474

    Re: No database selected...?

    can you give us some more code? and are you sure you have the database set up correctly?
    ------------------------------------------------------------------------------------------
    If you have any troubles with a website or a script, just send me a pm.

    I also code websites in xHTML/css, can code javascript and php too if needed

+ Reply to Thread

Similar Threads

  1. any idea??
    By galaxyAbstractor in forum Scripts & 3rd Party Apps
    Replies: 3
    Last Post: 11-12-2007, 12:24 PM
  2. MYSQL database
    By cabte in forum Free Hosting
    Replies: 4
    Last Post: 10-06-2007, 06:09 AM
  3. PHP BB 2.0.16 Manual instalation
    By GFIV in forum Free Hosting
    Replies: 8
    Last Post: 09-14-2005, 12:40 PM
  4. Database Mysql
    By TheCentaury in forum Free Hosting
    Replies: 3
    Last Post: 08-23-2005, 09:55 PM

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