Advertisement:

[1.1.4] ID_MSG_MODIFIED

Aloittaja Skhilled, toukokuu 04, 2008, 02:49:24 AP

« edellinen - seuraava »

Skhilled

Hi, I'm getting this error: [Field 'ID_MSG_MODIFIED' doesn't have a default valueFile: C:wwwzhaowei-international.comhtdocsSourcesSubs-Post.phpLine: 1653

Do I need to add a value to that field and if so, what?

Or do I need to modify Subs-Post.php?

rsw686

The field should have a default value of 0.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

Skhilled

#2
Thank you. :)

EDIT: I've tried that but it still getting the same. Here's were I've found it: CREATE TABLE `smf_messages` (
  `ID_MSG` int(10) unsigned NOT NULL auto_increment,
  `ID_TOPIC` mediumint( unsigned NOT NULL,
  `ID_BOARD` smallint(5) unsigned NOT NULL,
  `posterTime` int(10) unsigned NOT NULL,
  `ID_MEMBER` mediumint( unsigned NOT NULL,
  `ID_MSG_MODIFIED` int(10) unsigned NOT NULL default '0',
  `subject` tinytext NOT NULL,
  `posterName` tinytext NOT NULL,
  `posterEmail` tinytext NOT NULL,
  `posterIP` tinytext NOT NULL,
  `smileysEnabled` tinyint(4) NOT NULL default '1',
  `modifiedTime` int(10) unsigned NOT NULL,
  `modifiedName` tinytext NOT NULL,
  `body` mediumtext NOT NULL,
  `icon` varchar(16) NOT NULL default 'xx',
  PRIMARY KEY  (`ID_MSG`),
  UNIQUE KEY `topic` (`ID_TOPIC`,`ID_MSG`),
  UNIQUE KEY `ID_BOARD` (`ID_BOARD`,`ID_MSG`),
  UNIQUE KEY `ID_MEMBER` (`ID_MEMBER`,`ID_MSG`),
  KEY `participation` (`ID_MEMBER`,`ID_TOPIC`),
  KEY `ID_TOPIC` (`ID_TOPIC`),
  KEY `showPosts` (`ID_MEMBER`,`ID_BOARD`),
  KEY `ipIndex` (`posterIP`(15),`ID_TOPIC`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=740 ;
Is there somewhere else I should be looking?

I've forgot to mention that the error happens whenever someone tries to post, if that helps.

karlbenson

The ID_MSG_MODIFIED field controls what the last updated message was (normally thats the last post or when a post is edited, its updated to that)

By default it shouldn't need to specified in the query as it should take the default value.

In PHPMYADMIN on the structure of smf_messages table.
Look at the field ID_MSG_MODIFIED and what the default value is set to.

Have their been any recent mysql changes on your forum? Upgraded mysql?
It should be 0.
If not you'll need to change it to 0

Skhilled

Hi karlbenson,

I've already checked that field and set it to "0". But still the same.

Hmm, yes, mysql was upgraded, well, the db was moved from a site with mysql4 to one with mysql 5. I was going to run upgrade.php to see if that'll help also.

karlbenson

You could try setting to 0.

Line 1650
FIND
         (ID_BOARD,
REPLACE
         (ID_MSG_MODIFIED, ID_BOARD,

FIND
      VALUES (
REPLACE
      VALUES (0,

By default. SMF shouldn't need it set. I'm on mysql5 with no issues.
(I wonder whether its a bad mysql version)

Skhilled

Changed the first but the for the 2nd there are a few "values (".

   // Insert the message itself and then grab the last insert id.
   db_query("
      INSERT INTO {$db_prefix}personal_messages
         (ID_MEMBER_FROM, deletedBySender, fromName, msgtime, subject, body)
      VALUES ($from[id], " . ($store_outbox ? '0' : '1') . ", SUBSTRING('$from[username]', 1, 255), " . time() . ", SUBSTRING('$htmlsubject', 1, 255), SUBSTRING('$htmlmessage', 1, 65534))", __FILE__, __LINE__);
   $ID_PM = db_insert_id();


   // Insert the post.
   db_query("
      INSERT INTO {$db_prefix}messages
         (ID_MSG_MODIFIED, ID_BOARD, ID_TOPIC, ID_MEMBER, subject, body, posterName, posterEmail, posterTime,
         posterIP, smileysEnabled, modifiedName, icon)
      VALUES ($topicOptions[board], $topicOptions[id], $posterOptions[id], SUBSTRING('$msgOptions[subject]', 1, 255), SUBSTRING('$msgOptions[body]', 1, 65534), SUBSTRING('$posterOptions[name]', 1, 255), SUBSTRING('$posterOptions[email]', 1, 255), " . time() . ",
         SUBSTRING('$posterOptions[ip]', 1, 255), " . ($msgOptions['smileys_enabled'] ? '1' : '0') . ", '', SUBSTRING('$msgOptions[icon]', 1, 16))", __FILE__, __LINE__);
   $msgOptions['id'] = db_insert_id();


   // Insert a new topic (if the topicID was left empty.
   if ($new_topic)
   {
      db_query("
         INSERT INTO {$db_prefix}topics
            (ID_BOARD, ID_MEMBER_STARTED, ID_MEMBER_UPDATED, ID_FIRST_MSG, ID_LAST_MSG, locked, isSticky, numViews, ID_POLL)
         VALUES ($topicOptions[board], $posterOptions[id], $posterOptions[id], $msgOptions[id], $msgOptions[id],
            " . ($topicOptions['lock_mode'] === null ? '0' : $topicOptions['lock_mode']) . ', ' .
            ($topicOptions['sticky_mode'] === null ? '0' : $topicOptions['sticky_mode']) . ", 0, " . ($topicOptions['poll'] === null ? '0' : $topicOptions['poll']) . ')', __FILE__, __LINE__);
      $topicOptions['id'] = db_insert_id();


      if (empty($flag))
         db_query("
            REPLACE INTO {$db_prefix}log_topics
               (ID_TOPIC, ID_MEMBER, ID_MSG)
            VALUES ($topicOptions[id], $ID_MEMBER, $msgOptions[id] + 1)", __FILE__, __LINE__);
   }

   // If there's a custom search index, it needs updating...

karlbenson

Sorry, I meant the one only 2 lines down from where you added ID_MSG_MODIFIED.
So 1652 I believe.

Skhilled

Thanks, I changed that but now get: Database Error
Field 'modifiedTime' doesn't have a default value
File: C:wwwzhaowei-international.comhtdocsSourcesSubs-Post.php
Line: 1653


I then added "modifiedTime" to the same line and get: Column count doesn't match value count at row 1
File: C:wwwzhaowei-international.comhtdocsSourcesSubs-Post.php
Line: 1653


The code we are talking about is this:    // Insert the post.
   db_query("
      INSERT INTO {$db_prefix}messages
         (ID_MSG_MODIFIED, ID_BOARD, ID_TOPIC, ID_MEMBER, subject, body, posterName, posterEmail, posterTime,
         posterIP, smileysEnabled, modifiedName, modifiedTime, icon)
      VALUES (0, $topicOptions[board], $topicOptions[id], $posterOptions[id], SUBSTRING('$msgOptions[subject]', 1, 255), SUBSTRING('$msgOptions[body]', 1, 65534), SUBSTRING('$posterOptions[name]', 1, 255), SUBSTRING('$posterOptions[email]', 1, 255), " . time() . ",
         SUBSTRING('$posterOptions[ip]', 1, 255), " . ($msgOptions['smileys_enabled'] ? '1' : '0') . ", '', SUBSTRING('$msgOptions[icon]', 1, 16))", __FILE__, __LINE__);
   $msgOptions['id'] = db_insert_id();


It seems to keep asking for more tables. LOL

karlbenson

Modified time is already listed, so specifiying again wouldn't work.

Mysql isn't my forte.  But I'd suggest at this time at looking at your mysql.
How mysql is setup? Strict mode? http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html

Skhilled

Thanks, guys. This is now settled. I finally found out that I was adding '0' instead of 0 and when through the entire db and sorted each one that was causing errors. Also, while I was fixing the db the owner was trying to fix it as well. We were screwing each other up. LOL

Again, thanks for the help. :)

karlbenson


Advertisement: