On Tue, Jul 08, 2003 at 11:26:52AM -0400, Artoo wrote:
> 
> I keep getting  Parse error: parse error, unexpected T_LNUMBER in
> /usr/local/psa/home/create.php on line 9
> 
> This is line 9, which should just create a table.
> 
>  $result = mysql_query('CREATE TABLE members (userid INT(25) NOT NULL
> AUTO_INCREMENT, first_name VARCHAR(30) NOT NULL, last_name VARCHAR(50) NOT
> NULL, email_address VARCHAR(255) NOT NULL, username VARCHAR(30) NOT NULL,
> password VARCHAR(30) NOT NULL, activated ENUM('0','1') DEFAULT '0' NOT NULL,
> date_joined DATETIME NULL, last_login DATETIME NULL);')or die("Create table
> Error: ".mysql_error());
> 
> What's that error mean and is that CREATE TABLE query correct?

The CREATE TABLE is correct, but look at your ENUM values and DEFAULT.
What kind of quotes are you using?  How do you think they should be
interpreted?  For easier reading, let's split up the query....

 $q = 'CREATE TABLE members (userid INT() NOT NULL AUTO_INCREMENT, '
    . 'first_name VARCHAR(30) NOT NULL, '
    . 'last_name VARCHAR(50) NOT NULL, '
    . 'email_address VARCHAR(255) NOT NULL, '
    . 'username VARCHAR(30) NOT NULL, '
    . 'password VARCHAR(30) NOT NULL, '
    . 'activated ENUM("0","1") DEFAULT "0" NOT NULL, '
    . 'date_joined DATETIME NULL, '
    . 'last_login DATETIME NULL)';
 $result = mysql_query($q) or die("Create table Error: ".mysql_error());

It's a heck of alot easier to see errors when you space things out a
bit.  The investment of the extra CPU time for PHP to glue the pieces
together probably makes sense in the long run.

-- 
  Paul Chvostek                                             <[EMAIL PROTECTED]>
  it.canada                                            http://www.it.ca/
  Free PHP web hosting!                            http://www.it.ca/web/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to