#1
  1. No Profile Picture
    Dz9r
    Guest
    Devshed Newbie (0 - 499 posts)
    I have been beating my head into the wall and i just can't get it to work here is my code and i get a phase error on line 18 please help! or if that doesn't work its on the $sql .= $field_type line (3rd line of code)

    <?PHP

    $sql = "CREATE TABLE $table_name (";
    for ($i = 0; $i < count($field_name); $i++) {

    $sql .= $field_name[$i] $field_type[$i]";

    if ($field_length[$i] != "") {

    $sql .= " ($field_lenght[$i]),";

    } else {

    $sql .= ",";

    }


    }

    $sql = substr($sql, 0, -1);
    $sql .= ")";

    // Data base connection commands

    $connection = mysql_connect("localhost","dz9r","temp") or die ("Couldn't connect to server.");

    // Selecting database

    $db = mysql_select_db("bbstest",$connection) or die ("Couldn't execute query.");

    // Execute SQL Query and get results

    $sql_result = mysql_query($sql,$connection) or die ("Couldn't execute query.");

    if (!$sql_result) {
    echo "<P>Couldn't create table!";
    } else {
    echo "<P>$table_name has been created!";
    }

    ?>

    or just look at my web site and goto the dir and try it your self its adding a SQL table

    dz9r.phpwebhosting.com/chap4/

    the files are there please help help help i hate debuging it can suck and take all of peoples time!
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    <<
    $sql .= $field_name[$i] $field_type[$i]";
    >>


    you have missed a " quotes above..

    --
    $sql .="$field_name[$i] $field_type[$i]";

    --
    other things are ok i guess...


    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."

    [This message has been edited by Shiju Rajan (edited July 08, 2000).]

IMN logo majestic logo threadwatch logo seochat tools logo