SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    boiler up blackdog's Avatar
    Join Date
    Jul 2002
    Location
    Purdue
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    learning mysql...

    i'm just starting with a mysql tutorial and already i'm running into problems just trying to make a table. here's my code:
    Code:
    $user="mobilep_alex";
    $password="****";
    $database="mobilep_test";
    $host="localhost";
    mysql_connect($host,$user,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    $query="CREATE TABLE brothers (pin int(6) NOT NULL auto_increment,first varchar(15) NOT NULL,last varchar(15) NOT NULL,phone varchar(20) NOT NULL,email varchar(30) NOT NULL,web varchar(30) NOT NULL,PRIMARY KEY (pin),UNIQUE id (pin),KEY id_2 (pin))";
    mysql_query($query);
    mysql_close();
    but after I execute it, I look in phpmyadmin and it shows no tables in the database. anyone know whats wrong?

    thanks!

  2. #2
    SitePoint Wizard Lats's Avatar
    Join Date
    Jun 2003
    Location
    Melbourne, AU
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just ran your query on a test db without problem.

    Try adding or die(mysql_error()) to your second query, you may not have permission to create a table.
    Lats...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •