Error: "The database value you're trying to insert does not exist: id_msg"

Started by Arwym, July 24, 2009, 02:15:55 AM

Previous topic - Next topic

Arwym

EDIT!

I fixed the original problem, explained at the end of this post, but...


Now I can't access any forum posts.  Every time I try to do that, I get the following:
QuoteThe database value you're trying to insert does not exist: id_msg

No idea why.

Something I discovered while trying to fix the previous error was that my entire settings table was EMPTY.  Since there were not even default settings set, I was having all those problems.  But I already filled all the settings, I think.  I don't know what may be causing this.





Hello!

Originally, I installed two message boards with SMF2.0 RC1 successfully.  There were no errors, no problems.  Everything was working perfectly.  Until one day, the server where I'm hosted at had a strange issue with MySQL.  Almost every script I had installed became unusable, throwing strange errors at me.  Including SMF.

Then, the problem was solved and most scripts were back to normal.  Except my two SMF message boards.

Every time I try to access them, I get the following:

QuoteThe database value you're trying to insert does not exist: theme_guests

At first I thought it could be one of the mods, but one of the boards has no mods and still gives me the exact same error message.  So, it could be anything.

I'm trying to understand what it could be, and nothing comes to mind.  If it's talking about a table field called theme_guests, which table would contain this field?  Or maybe I misunderstood the message.

I'd really like to solve this problem.  Any idea what it could be or how to fix it?

Let me know if you need more information.

Arwym

Sorry for the double post.  The original problem was solved, but a new, related issue appeared.  I'm almost 100% sure it's related, thus I leave the original message for you to read.  I found no need to start a new thread.

I really need help with this.  Anything you can do to help will be greatly appreciated.

Arwym

Sorry for posting again, but my thread was already in the second page.  I really need help with this.

Arantor

Please can we have the full error message - as in what file that occurs from?

Arwym

Sure!

Here:

Quote
The database value you're trying to insert does not exist: id_msg
File: /Sources/Display.php
Line: 387

Quote367:  $context['page_title'] = $topicinfo['subject'];
368:    
369:   // Is this topic sticky, or can it even be?
370:  $topicinfo['is_sticky'] = empty($modSettings['enableStickyTopics']) ? '0' : $topicinfo['is_sticky'];
371:    
372:  // Default this topic to not marked for notifications... of course...
373:  $context['is_marked_notify'] = false;
374:    
375:  // Guests can't mark topics read or for notifications, just can't sorry.
376:  if (!$user_info['is_guest'])
377:  {
378:  $smcFunc['db_insert']('replace',
379:  '{db_prefix}log_topics',
380:  array(
381:  'id_member' => 'int', 'id_topic' => 'int', 'id_msg' => 'int',
382:  ),
383:  array(
384:  $user_info['id'], $topic, $modSettings['maxMsgID'],
385:  ),
386:  array('id_member', 'id_topic')
387:  );
388:   
389:  // Check for notifications on this topic OR board.
390:  $request = $smcFunc['db_query']('', '
391:  SELECT sent, id_topic
392:    FROM {db_prefix}log_notify
393:  WHERE (id_topic = {int:current_topic} OR id_board = {int:current_board})
394:  AND id_member = {int:current_member}
395:  LIMIT 2',
396:  array(
397:  'current_board' => $board,
398:  'current_member' => $user_info['id'],
399:    'current_topic' => $topic,
400:  )
401:     );
402:     $do_once = true;
403:  while ($row = $smcFunc['db_fetch_assoc']($request))
404:  {
405:  // Find if this topic is marked for notification...
406:  if (!empty($row['id_topic']))
407:  $context['is_marked_notify'] = true;

Arwym


Arwym


Sarge

Hello Arwym and sorry for the late reply. Do you still need assistance with this?

It seems that the database structure is messed up, probably because of the hosting server issues you mentioned in your original post. Do you have a database backup from before the issues started to happen?

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

Arwym

Hello, and sorry for the late reply myself.

Unfortunately, I don't have a backup of earlier versions.  The forums weren't open for public yet.  They were still under construction --but I had almost finished when this happened.

I am still interested in fixing this, but something tells me there's no real/easy fix, and I might just have to start over.

Arwym

And I just discovered another detail: this error only appears if the user is logged in.  As a guest, I can see everything perfectly.  Now that is strange.  >.<

Arwym


Norv

Sorry for the delay.
If your database may have lost data because of the crash or whatnot of your host's server, there is not a very good way for us to guarantee we find all the problems, it might be better if you tried reinstalling. Do you have many mods, would reinstalling hurt much?

Also, can you please tell, how did you re-add the settings in the settings table?
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Arwym

I tried changing the info for every setting I could find again, and as I saved them, they were added to the database, is my guess.  So maybe what's happening here is that a setting is missing, but I don't know which.  All I can think of now is, create a new forum and compare the settings in both database, to see what's missing or if there's any other difference.

The board had a few mods installed and some of my own manual changes; plus, all the forums and subforums with their descriptions and stickies.  I would simply create a new board and use it instead, if it weren't for that.

Norv

The table with most settings is smf_settings. You could log in phpMyAdmin, and "export" it in it own .sql file (make sure you tick the "data" checkbox), then attach that file here. There shouldn't be major security concerns, but it does contain paths on your server, which is a certain risk though. Alternatively, if you want, you can PM its contents to me.
Note however that this seems to be related to a setting in smf_members instead, as your error message seems to complain about a query using the values in the column id_msg_last_visit in the members table. You shouldn't attach those contents here though. (Eventually, please free to PM them to me, or let us know what are the type of the column id_msg_last_visit and its values throughout the member list). For example, see if by any chance that column has null values (instead of 0 at most) or doesn't exist.

In case the above fails or seems to take too long, as an yet another alternative, you can also consider making a full export of the database, and even a copy of the files, and make them both available to me. In case you agree, please let me know. I would try to install locally (on my computer) a copy of your forum, and in case I can replicate the problem, we can have more directly the solution as well.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Advertisement: