| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Member Join Date: Jan 2007
Posts: 98
![]() | Invalid default value on mysql. Hello, I am triying to install this database but i get an error. Error message is #1067 - Invalid default value for 'article_id' Here is my database create table articles ( id int(11) NOT NULL auto_increment, name varchar(30) NOT NULL default '', title varchar(40) NOT NULL default'', content text NOT NULL, date datetime NOT NULL default'0000-00-00 00:00:00', ip varchar(20) NOT NULL default'', primary key (id) ) TYPE=MyISAM auto_increment=1 ; create table comments ( id int(11) NOT NULL auto_increment, article_id int(11) NOT NULL default '', ????: NamePros.com http://www.namepros.com/programming/390932-invalid-default-value-on-mysql.html name varchar(30) NOT NULL default '', website varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', comment text NOT NULL, date datetime NOT NULL default'0000-00-00 00:00:00', ip varchar(20) NOT NULL default '', primary key (id) ) TYPE=MyISAM auto_increment=1 ; Thanks for your help |
| |
| | #2 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | it works 100% here you could always try changing article_id int(11) NOT NULL default '', to:- article_id int(11) default '',
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
| | #4 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | neroux if he does that there is a potential problem. If for example he has an article with an id of 0 when selecting by article_id he will have 2 to choose from.
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
| | #5 (permalink) |
| NamePros Regular Join Date: Oct 2006
Posts: 963
![]() ![]() | Given that the articles are based on autoincrement values an article should never get a 0. But even if one does, it wouldnt matter. Anyhow, although '' should work for an integer value it is syntactically wrong. Also allowing NULL could lead to unassociated comments. |
| |
| | #6 (permalink) | ||||
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft | ||||
| |
| | #7 (permalink) | ||||
| NamePros Regular Join Date: Oct 2006
Posts: 963
![]() ![]() |
| ||||
| |