[urgent]Mysql problem
#1

guys. i got a problem with mysql.it gives error invalid default value for "id" and invalid default value for "birthdate" the default value of id is set to none and brithdate's default value to 000-00-00. any idea to fix it?
Reply
#2

Set auto increment for "id" column so it will generate the unique number itself when not specified or set as NULL in an INSERT query (make sure it is also set as PRIMARY KEY).

What data type "birthdate" is? If it is set for example as integer (int), it won't let you create the table and give you error #1067 because the default value '0000-00-00' is invalid. The data type would have to be set as DATE for it to work.
Reply
#3

birthdate is set to DATE
Reply
#4

anyone? its urgent
Reply
#5

Can you post the CREATE TABLE query? The problem might also be with sql modes (NO_ZERO_IN_DATE or NO_ZERO_DATE) for 5.7 mysql version.
Reply
#6

how to edit the table ._. ? Newbie :v and im using a database not created by me
Reply
#7

If you have phpmyAdmin, select the database and in "SQL" tab execute:
pawn Код:
SHOW CREATE TABLE table_name;
An example can be shown here: http://i.imgur.com/eJaoxOw.png
Reply
#8

Its in "accounts" table's columns. Now what should be the cmd to execute?
Reply
#9

BirthDate` date NOT NULL DEFAULT '0000-00-00',

?
Reply
#10

That is a valid default value if "NO_ZERO_DATE" sql mode is disabled. According to mysql's site

Quote:

If this mode (NO_ZERO_DATE) and strict mode are enabled, '0000-00-00' is not permitted and inserts produce an error, unless IGNORE is given as well. For INSERT IGNORE and UPDATE IGNORE, '0000-00-00' is permitted and inserts produce a warning.

So you have to find and edit the sql modes.

Is it Windows or Linux? If it is Windows, what are you using for mysql service (WAMP, XAMPP)?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)