#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    12
    Rep Power
    0
    Hi, Exists a function like mysql_create_table(...) to create tables in a MySql-database from PHP4 ?

    The code I'm using is:
    <?php
    $dbh = mysql_connect('localhost', $username, $password);
    $dbh = mysql_select_db($dbname);

    Can somebody tell me how can I create a table, Please?

    Thanks
    Jdv


  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    0
    Rep Power
    0
    use this code

    $sql ="create table tbl ( id int(11) NOT NULL auto_increment PRIMARY KEY ,
    name varchar(20), email varchar(20)";
    $result = mysql_db_query("database", $sql);
    -----------------------------------------
    JND Designs www.jnddesigns.net
    Web Developers Freelance Network

    [This message has been edited by jnd (edited November 13, 2000).]
  4. #3
  5. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,646
    Rep Power
    4492
    Anything you do from the command line in MySQL can be done in a mysql_query() function.

    ---John Holmes...
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    12
    Rep Power
    0
    Thanks !! It works.

IMN logo majestic logo threadwatch logo seochat tools logo