I'm running a script to populate a mysql database and keep getting this error:
Invalid default value for 'log' at row 35
the lines concered are
Code:
$q1 = "DROP TABLE IF EXISTS site_log";
mysql_query($q1) or die(mysql_error()." at row ".__LINE__);
$q1 = "CREATE TABLE site_log (
id int(10) NOT NULL auto_increment,
log int(10) NOT NULL default '',
PRIMARY KEY (id))";
mysql_query($q1) or die(mysql_error()." at row ".__LINE__);
$q1 = "INSERT INTO site_log VALUES (1,1)";
mysql_query($q1) or die(mysql_error()." at row ".__LINE__);
Can anyone see whats wrong? the rest of the tables populate if I comment the above section out...?
__________________ I Just a test to see what happens... Please login or register to view this content. Registration is FREE
"Let us be thankful for the fools. But for them the rest of us could not succeed..."
it's because log is of type "int" but you passed it an empty string '' as default. Seeing how it is of type "int", you will need to give it a default number, maybe zero? You could also allow it to be NULL (instead of NOT NULL), and make the default NULL.
__________________
Join me on Please login or register to view this content. Registration is FREE