#1
  1. No Profile Picture
    Terry
    Guest
    Devshed Newbie (0 - 499 posts)
    Is my code way off base? I can't get a table
    created using php.

    $sql = "CREATE TABLE '$table'(
    partno CHAR(10) NOT NULL,
    descript CHAR(60) NOT NULL,
    cost DOUBLE(10,5) NOT NULL,
    user CHAR(15) NOT NULL,
    modelno CHAR(20) NOT NULL,
    PRIMARY KEY(partno))";

    $result = MYSQL_QUERY($sql) or die
    ("Invalid create");

  2. #2
  3. No Profile Picture
    moderator
    Guest
    Devshed Newbie (0 - 499 posts)
    I don't think you need the apostrophe's (') around the table name. That could be what's messing it up.
  4. #3
  5. No Profile Picture
    rod k
    Guest
    Devshed Newbie (0 - 499 posts)
    Also, instead of using "or die" which doesn't give you any info, on the next line do this:

    if (!$result){
    print mysql_error();
    exit;
    }

    This exits gracefully while still giving you the info you need to determine what went wrong.

    HTH

    Rod

Similar Threads

  1. How to include part of a mysql DB into a php table row??
    By gushh-reloaded in forum PHP Development
    Replies: 1
    Last Post: September 8th, 2003, 10:57 AM
  2. Replies: 2
    Last Post: May 19th, 2003, 12:05 PM
  3. Apache login with mysql table and PHP
    By quiquedcode in forum Apache Development
    Replies: 1
    Last Post: March 7th, 2002, 01:23 AM
  4. Run PHP code grabbed from a MySql table
    By phil.john in forum PHP Development
    Replies: 1
    Last Post: May 21st, 2001, 05:35 PM
  5. Uknow Known MYSQLERROR
    By andyw in forum MySQL Help
    Replies: 7
    Last Post: January 23rd, 2001, 09:34 AM

IMN logo majestic logo threadwatch logo seochat tools logo