www.webdeveloper.com
Results 1 to 4 of 4

Thread: Mysql plz

  1. #1
    Join Date
    Mar 2006
    Posts
    24

    Mysql plz

    just started learning php mysql dont know if i am doing this right

    trying to create a database with 4 columns

    this is what i have so far
    PHP Code:
     <html>
    <head>
    <title>
    mysql databser
    </title>
    </head>
    <body>
    <? php

    $new_db 
    "testDB2";

    $connection mysql_connect("localhost""craig""1978");
    if (!
    $connection)
    {
    die(
    "Could not connect to the server");
    }

    $result mysql_create_db($new_db$connection);

    if (
    $result)
    {
    $msg "Congrats! Your database has been created!";
    }
    else
    {
    die(
    "Could not create a new database");
    }

    ?>

    <p><?php echo $msg?></p>
    </body>
    </html>
    Code:
    mysql>creat database testDB2;
    
    mysql>use testDB2;
    
    mysql>create table table_name (
    
    column_1_name column_1_type column_1_details,
    column_2_name column_2_type column_2_details,
    column_3_name column_3_type column_3_details,
    column_4_name column_4_type column_4_details,
    ...
    );
    
    mysql>create table dbmyrestaurant (
    
    Itemid int not null auto_increment primary key,
    
    );

    can any one help me please

    thanks
    Last edited by NogDog; 04-06-2006 at 09:03 AM. Reason: Added PHP tags

  2. #2
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    well what is the problem?

  3. #3
    Join Date
    Mar 2006
    Posts
    24
    just want to know if this code is right

  4. #4
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    some is, some isn't. "creat" isn't a function or a process that you can call, some of your php function calls are deprecated. you dont' use a comma for the last element in a table.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles