Mysql - "No database selected"?

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by bobrocket9942, Oct 15, 2011.

  1. bobrocket9942

    bobrocket9942 New Member

    Hi guys!
    I was making a gaming community website, and when I was pulling a mysql connect for an activation code, I get an error saying "No database found" (It's a mysql_error() thing..)

    The code:
    <?php


    $server = "localhost";
    $dbuser = "bobrocke_1";
    $dbpass = "*********";
    $database = "bobrocke_users";


    mysql_connect($server, $dbuser, $dbpass);
    mysql_select_db($database);


    ?>

    The database is "bobrocke_users" and the table is "users" if that helps..
    Thanks!
  2. John Rambo

    John Rambo New Member

    Does database exist and spelt correctly? You can check it by sql SHOW DATABASES query.
  3. bobrocket9942

    bobrocket9942 New Member

    It's spelt correctly.
    Checked the databases;
    "bobrocke_users" which is exactly what I have in the code.

    ---------- Post added at 05:40 PM ---------- Previous post was at 04:01 PM ----------

    Fixed it!
    I hadn't put the user into the database. xD Rookie error, right? :)

Share This Page