Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.