Jump to content

[SOLVED] Sql Error


eaglelegend

Recommended Posts

Hey guys, I am having this sql problem as you will see below, and I was wondering if you guys could help me spot what the issiue is - many thanks in advance!

 

Error

SQL query:

# MySQL dump 7.1
#
# Host: localhost Database: el_labs
#--------------------------------------------------------
# Server version 3.22.32
#
# Table structure for table 'colors'
#
CREATE TABLE colors(
id int( 11 ) DEFAULT '0' NOT NULL AUTO_INCREMENT ,
hex varchar( 6 ) DEFAULT 'dddddd' NOT NULL ,
label varchar( 20 ) DEFAULT 'Medium Gray' NOT NULL ,
PRIMARY KEY ( id )
);

MySQL said: Documentation
#1067 - Invalid default value for 'id' 

Link to comment
https://forums.phpfreaks.com/topic/147420-solved-sql-error/
Share on other sites

Try:

 

CREATE TABLE colors(
id int( 11 ) NOT NULL AUTO_INCREMENT ,
hex varchar( 6 ) DEFAULT 'dddddd' NOT NULL ,
label varchar( 20 ) DEFAULT 'Medium Gray' NOT NULL ,
PRIMARY KEY ( id )
);

 

you can't have default value for AUTO_INCREMENT since it is... autoincremented on each insert.

 

 

Link to comment
https://forums.phpfreaks.com/topic/147420-solved-sql-error/#findComment-773787
Share on other sites

LOL my real server version is LOL, that particular script last update from the actual developer was 2000 - 9 years ago, although looking at where I got it from, 9 years later one of the developers say they are going to update it LOL - well I am going to try and update the script myself, along with many other scripts - however I am testing them all in a very secured area - knowing that scripts that old could be a big security risk!

Link to comment
https://forums.phpfreaks.com/topic/147420-solved-sql-error/#findComment-773985
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.