You shouldn't have a default value in an auto increment field. You can set 
AUTO_INCREMENT to 0 and start with 1, but as auto increment is a unique field 
and its automagically incremented, you should not set a default value on it...
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Thijs Lensselink <d...@lenss.nl> wrote:

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 03/02/2011 07:56 AM, Ashim 
Kapoor wrote: > Dear all, > > I am trying to make a website with php and I 
found the following code in a > book and I am trying to import it. The 
following are the beginning of the > file i am trying to import with the 
command > > mysql -u root -pmypassword certainty < dump > > I get the following 
error : ERROR 1067 (42000) at line 9: Invalid default > value for 'id' > > but 
when I see line 9 i see the value '0' for id which seems ok to me, I > also 
tried removing the quotes but same error. > > Can someone guide me ? > > Thank 
you, > Ashim > > # MySQL dump 7.1 > # > # Host: [host deleted] Database: 
certainty > #_____________________________________________
> # Server version 3.22.32 > # > # Table structure for table 'high_scores' > # 
> > CREATE TABLE high_scores ( > id int(11) DEFAULT '0' NOT NULL 
> auto_increment, > name varchar(30), > answer_count int(11), > credit 
> double(16,4), > PRIMARY KEY (id) > ); > It's not really a PHP question. But 
> here goes. Your first field "id" is an auto_increment field this means the 
> counter goes up by every insert. Normally this will start at 1 not 0. So 
> either change the 0 to a higher number or remove the auto_increment part 
> before you import change the 0 after and alter the table to put back 
> auto_increment -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 
> (GNU/Linux) iQIcBAEBAgAGBQJNbfOvAAoJEMffsHAOnubXC7UP/1k5qA4TDxDnUKrYZLV/rl9s 
> bLRPTQ21riFMIzt0ne14No4+MTwjNtfVAdSnjpCWEZP+Y2MEixaiz8gIcOt9GIOD 
> f9QPJZFEIcVADs3lqeS88eqdgRBNiYy3x2PHyslR3jtuaeFrRvxOLBTgBISq6Ih4 
> Dd5nRCbo6WObQ5e26HhbDeMJDAnOw4iQMjpoxc6UD9syxkJrORYw6XFvEmJA/QNF 
> RDTNIO7P62ROamGor8urmPdfIemFLyqjD5YAQ64O6aWVHp0ehjO4l1xPWCeI84sV
2g8C3yqi06UjYOE8NHrf64VYcQtvLFkJbzGT6mmPwEP0gBdqX6o2YDwnudv7+APN 
F5zoVBv/7wygFaP+P0zgJ+EWVML35VfJFuq5VCH3CUk1hROS4X/JtsNXdVkAbaFA 
BpEhQ4jN0x/34HrI1cWjEUwaUuU6m9XoMIuO+1tQRLFatEW9I5z1c3hrJsPUNImX 
qSxEGLAZyA7tex++4YFn8DZXWz4mdllI7yejRe0nl1vl4Nn1+t2se/vF0TfZAGdB 
HgDeUWTdY/N2KeT4z9gPjGEDlRp8Wqo13Sv1yVhzWDdAJQdWaH8+Kk0GCI0jBrgT 
Pthmjr0e4bKCW19SJtL7/mTRU12qX/kbjMG5JqIh1ixn72qgqcvkTjgvEeQ1Y0DM 
xBBFUUedwoKevRJI05/2 =mdri -----END PGP SIGNATURE----- -- PHP General Mailing 
List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 

Reply via email to