Reply
Old 01-08-2009, 12:12 PM error? somewhere?
rolda hayes's Avatar
Webmaster Talker

Posts: 650
Name: Darren
Location: England
Trades: 0
Hi,

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 always wanted the adoration of John Lennon - With The Anonimity of Ringo Starr..."
QuizBay Help with the testing of this Beta site!
rolda hayes is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 01-08-2009, 01:01 PM Re: error? somewhere?
wayfarer07's Avatar
NYE-KEE

Posts: 3,155
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
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.
__________________
Wayfarer | jQuery Tooltip Plugin | Mapbox: the jQuery Map
Freelance Jobs Available
If Google is the Coca-Cola of Web search, Bing is RC Cola
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 01-08-2009, 02:14 PM Re: error? somewhere?
Insensus's Avatar
Ultra Talker

Posts: 487
Name: Mark Stegeman
Location: Netherlands, Europe
Trades: 0
If you don't want to set a default value, just remove the default ''.
I think it isn't required.
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>
Insensus is offline
Reply With Quote
View Public Profile
 
Old 01-08-2009, 02:28 PM Re: error? somewhere?
Insensus's Avatar
Ultra Talker

Posts: 487
Name: Mark Stegeman
Location: Netherlands, Europe
Trades: 0
We need a topic relevancy checker for recently registered users. :P
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>
Insensus is offline
Reply With Quote
View Public Profile
 
Old 01-08-2009, 02:30 PM Re: error? somewhere?
wayfarer07's Avatar
NYE-KEE

Posts: 3,155
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Quote:
Originally Posted by Insensus View Post
If you don't want to set a default value, just remove the default ''.
I think it isn't required.
That's true also.
__________________
Wayfarer | jQuery Tooltip Plugin | Mapbox: the jQuery Map
Freelance Jobs Available
If Google is the Coca-Cola of Web search, Bing is RC Cola
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 01-08-2009, 04:09 PM Re: error? somewhere?
rolda hayes's Avatar
Webmaster Talker

Posts: 650
Name: Darren
Location: England
Trades: 0
Thanks for the advise guys - I got the database running but the script I purchased is so full of errors you wouldnt believe it!

COntacted support and they offered to install it - for MORE money than I payed for the script itself!!!

It's going to be a long night...
__________________
"I always wanted the adoration of John Lennon - With The Anonimity of Ringo Starr..."
QuizBay Help with the testing of this Beta site!
rolda hayes is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to error? somewhere?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.13803 seconds with 13 queries