Free2Code
 
Time: 2008-11-21, 07:45am
login system
Subject: login system  ·  Posted: 2008-08-16, 05:02am
Rank: ? (2)
Member #: 29788
hi all
when i go in to phpmyadmin and input this in to SQL:

CREATE TABLE users (
id int(10) DEFAULT '0' NOT NULL auto_increment,
username varchar(40),
password varchar(50),
regdate varchar(20),
email varchar(100),
website varchar(150),
location varchar(150),
show_email int(2) DEFAULT '0',
last_login varchar(20),
PRIMARY KEY(id))

i get this error:
#1067 - Invalid default value for 'id' eek

help rolleyes plz.........


» Post edited 2008-08-16, 05:02am by thebot.

 
  Reply to this ·  Post link ·  Top
Subject: Re: login system  ·  Posted: 2008-09-04, 08:50am
Rank: ? (44)
Member #: 22823
Hi there,

Fix: remove the DEFAULT definition from the 'id' column entirely.
Why: you can't use the DEFAULT definition on an auto_increment column. Auto_increment columns automatically start counting at 0 anyway.

The code should look like this:

CREATE TABLE users (
id int(10) NOT NULL auto_increment,
username varchar(40),
password varchar(50),
...

That's the simplest fix. ^_^
-sw

We put the fun in fungus.
 
  Reply to this ·  Post link ·  Top
Subject: Re: login system  ·  Posted: 2008-09-04, 11:01am
Rank: ? (2)
Member #: 29788
o ok

well i fixed it now because i posted this Subject on the 2008-08-16 eek.

but thank you lol

 
  Reply to this ·  Post link ·  Top

Pages: 1

Please login or register to post a reply.

icons