Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

Error When Trying To Split Threads

Aloittaja Mikeric, lokakuu 19, 2008, 10:35:54 IP

« edellinen - seuraava »

Mikeric

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4
File: /home/mikeric/public_html/Sources/SplitTopics.php
Line: 711

If i try and split a thread i get that error and loose everything after that post in the thread.

Oldiesmann

How many posts are in the topic, and which option are you chosing after clicking "Split Topic"? I'll play around with this some more on my 2.0 test board and see if I can get that error to occur.
Michael Eshom
Christian Metal Fans

Mikeric

I was trying to move all the posts below, it was about 6 posts.

Oldiesmann

I can't reproduce this at all.

Go to Admin -> Configuration -> Security and Moderation
Check the box next to "Include database query in the error log"

Try to split a topic again. When you get the error, go to your error log, copy the query, and paste it here. That will allow me to see specifically what's going on.
Michael Eshom
Christian Metal Fans

Mikeric

Apply Filter: Only show the error messages of this member  mike  Reverse chronological order of list  Today at 11:08:21 PM
Apply Filter: Only show the error messages of this IP address 75.69.132.164    Apply Filter: Only show the error messages of this session f5ec8b7eb8e4831fc3bc97e1bf05f974
  Apply Filter: Only show the errors of this type Type of error: Database
Apply Filter: Only show the error messages of this URL http://74.54.73.210/~mikeric/index.php?action=splittopics;sa=execute;topic=87.0
Apply Filter: Only show the errors with the same message
Database Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4


UPDATE smf_thank_you_post
SET
id_topic = 88
WHERE id_msg IN ()
Apply Filter: Only show the errors from this file
File: /home/mikeric/public_html/Sources/SplitTopics.php
Line: 711


Thats the error

Oldiesmann

Ok. That would be an error with a mod. Can you post lines 711 through the end of that query here?
Michael Eshom
Christian Metal Fans

Mikeric

What lines would you need, 711 to what im not really sure, i can tell it has to do with the thank you mod though. I just dont know how to tell what you need.

Is this what you need?
//Move the Thank You Post over to the other topic... b�h this is work :(
$smcFunc['db_query']('', "
UPDATE {db_prefix}thank_you_post
SET
id_topic = $split2_ID_TOPIC
WHERE id_msg IN ($postList)");

// Cache the new topics subject... we can do it now as all the subjects are the same!
updateStats('subject', $split2_ID_TOPIC, $new_subject);
}

Oldiesmann

The issue here is that $postList isn't defined anyway (although that query isn't even formatted properly for SMF 2.0...)

Replace that query with this one:

//Move the Thank You Post over to the other topic... bäh this is work :(
$smcFunc['db_query']('', "
UPDATE {db_prefix}thank_you_post
SET
id_topic = {int:id_topic}
WHERE id_msg IN ({array_int:split_msgs})",
array(
'id_topic' => $split2_ID_TOPIC,
'split_msgs' => $splitMessages
));
Michael Eshom
Christian Metal Fans

Mikeric

I replaced it and got this error now.

Apply Filter: Only show the error messages of this member  mike  Reverse chronological order of list  Today at 09:15:39 PM
Apply Filter: Only show the error messages of this IP address 75.69.132.164    Apply Filter: Only show the error messages of this session 008bdf9e53c75ab96259d159f685d3e8
  Apply Filter: Only show the errors of this type Type of error: Database
Apply Filter: Only show the error messages of this URL http://74.54.73.210/~mikeric/index.php?action=splittopics;sa=execute;topic=87.0
Apply Filter: Only show the errors with the same message
Database Error: Duplicate entry '0-15' for key 2


INSERT INTO smf_topics(`id_board`, `id_member_started`, `id_member_updated`, `id_first_msg`, `id_last_msg`, `num_replies`, `unapproved_posts`, `approved`, `is_sticky`)
VALUES
(15, 1, 1, 0, 0, 0, 0, 1, 0)
Apply Filter: Only show the errors from this file
File: /home/mikeric/public_html/Sources/SplitTopics.php
Line: 680


The code from line 680 is this.

// We're off to insert the new topic!  Use 0 for now to avoid UNIQUE errors.
$smcFunc['db_insert']('',
'{db_prefix}topics',
array(
'id_board' => 'int',
'id_member_started' => 'int',
'id_member_updated' => 'int',
'id_first_msg' => 'int',
'id_last_msg' => 'int',
'num_replies' => 'int',
'unapproved_posts' => 'int',
'approved' => 'int',
'is_sticky' => 'int',
),
array(
(int) $id_board, $split2_firstMem, $split2_lastMem, 0,
0, $split2_replies, $split2_unapprovedposts, (int) $split2_approved, 0,
),
array('id_topic')
);

Mikeric

anyone know what this error could be caused by?

Mikeric

Any Help? im still having issues with this.

greyknight17

These duplicate key errors can be a pain to solve. Go into your smf_topics database table and try looking for any duplicates. It should be on id_board 15.

krom_stormbrow

I'm having the exact same issues.

... so when in the database and should we find any duplicates. What is the best course of action?

Mikeric

Lainaus käyttäjältä: greyknight17 - marraskuu 01, 2008, 10:15:58 IP
These duplicate key errors can be a pain to solve. Go into your smf_topics database table and try looking for any duplicates. It should be on id_board 15.

I checked That and i got two different ones, that was all. At least i think they are different, i have never done anything in databases before. All the info on them was different in phpmyadmin.

krom_stormbrow

Ok, checked my database around id_board15 and no duplicates.

I have just had this happen again.

Mikeric


Rumbaar

I'm wondering what mod caused this in the first place, what mods did you install that weren't correctly written for 2.x?  Please list them all.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Mikeric

I think it has to do with the vb thank you one. The first part of it that someone earlier  in the thread helped fix had to do with that.

krom_stormbrow

This topic needs unmarking as solved.

I have checked my database: smf_topics database. Apparently no duplicates around the board id of 15.

I get this code in my error log:

660:
661: // We're off to insert the new topic!  Use 0 for now to avoid UNIQUE errors.
662: $smcFunc['db_insert']('',
663: '{db_prefix}topics',
664: array(
665: 'id_board' => 'int',
666: 'id_member_started' => 'int',
667: 'id_member_updated' => 'int',
668: 'id_first_msg' => 'int',
669: 'id_last_msg' => 'int',
670: 'num_replies' => 'int',
671: 'unapproved_posts' => 'int',
672: 'approved' => 'int',
673: 'is_sticky' => 'int',
674: ),
675: array(
676: (int) $id_board, $split2_firstMem, $split2_lastMem, 0,
677: 0, $split2_replies, $split2_unapprovedposts, (int) $split2_approved, 0,
678: ),
679: array('id_topic')
==>680: );
681: $split2_ID_TOPIC = $smcFunc['db_insert_id']('{db_prefix}topics', 'id_topic');
682: if ($split2_ID_TOPIC <= 0)
683: fatal_lang_error('cant_insert_topic');
684:
685: // Move the messages over to the other topic.
686: $new_subject = strtr($smcFunc['htmltrim']($smcFunc['htmlspecialchars']($new_subject)), array("\r" => '', "\n" => '', "\t" => ''));
687: // Check the subject length.
688: if ($smcFunc['strlen']($new_subject) > 100)
689: $new_subject = $smcFunc['substr']($new_subject, 0, 100);
690: // Valid subject?
691: if ($new_subject != '')
692: {
693: $smcFunc['db_query']('', '
694: UPDATE {db_prefix}messages
695: SET
696: id_topic = {int:id_topic},
697: subject = {string:new_subject}
698: WHERE id_msg IN ({array_int:split_msgs})',
699: array(
700: 'split_msgs' => $splitMessages,


From the previous posts from Mikeric working with Oldiesmann it seems to be linked to the thank you mod.

Here is the list of my installed mods:

1.   Spoiler Tag    0.6     [ Uninstall ] [ List Files ] [ Delete ]
2.   Thank-O-Matic    2.0 Beta 4     [ Uninstall ] [ List Files ] [ Delete ]
3.   Ad Managment    2.3.4     [ Uninstall ] [ List Files ] [ Delete ]
4.   Users Online Today    1.5.4     [ Uninstall ] [ List Files ] [ Delete ]
5.   Admin Notepad    1.0     [ Uninstall ] [ List Files ] [ Delete ]
6.   User Control Panel By Alan S    2.0.2     [ Uninstall ] [ List Files ] [ Delete ]
7.   Avatar Under Membergroups Rank    2.0.B4     [ Uninstall ] [ List Files ] [ Delete ]
8.   Pm_Informer    1.0     [ Uninstall ] [ List Files ] [ Delete ]
9.   Display Location on posts    1.0   [ Apply Mod ] [ List Files ] [ Delete ]
10.   More Spiders    1.2     [ Uninstall ] [ List Files ] [ Delete ]
11.   Auto Embed Video/Audio Clips    3.1.2     [ Uninstall ] [ List Files ] [ Delete ]


Now checking through my error logs - I have had three critical errors: Here are each of there codes:

Number 1:
SteveBerenyi Today at 09:43:17
192.104.231.235  496b17d0bafb17d22e318f95b2ee91c0
Type of error: Critical
http://www.minus1mod.com/smf/index.php?action=thankyoupostdelete;topic=1770.0;msg=28034;sesc
Wrong value type sent to the database. Integer expected.
Function: updateMemberData
File: /home/minusmod/public_html/smf/Sources/Subs.php
Line: 564


and related code:
544: // Ensure posts, instant_messages, and unread_messages don't overflow or underflow.
545: if (in_array($var, array('thank_you_post_became', 'thank_you_post_made')))
546: {
547: if (preg_match('~^' . $var . ' (\+ |- |\+ -)([\d]+)~', $val, $match))
548: {
549: if ($match[1] != '+ ')
550: $val = 'CASE WHEN ' . $var . ' <= ' . abs($match[2]) . ' THEN 0 ELSE ' . $val . ' END';
551: $type = 'raw';
552: }
553: }
554:
555: $setString .= ' ' . $var . ' = {' . $type . ':p_' . $var . '},';
556: $parameters['p_' . $var] = $val;
557: }
558:
559: $smcFunc['db_query']('', '
560: UPDATE {db_prefix}members
561: SET' . substr($setString, 0, -1) . '
562: WHERE ' . $condition,
563: $parameters
==>564: );
565:
566: updateStats('postgroups', $members, array_keys($data));
567:
568: // Clear any caching?
569: if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2 && !empty($members))
570: {
571: if (!is_array($members))
572: $members = array($members);
573:
574: foreach ($members as $member)
575: {
576: if ($modSettings['cache_enable'] >= 3)
577: {
578: cache_put_data('member_data-profile-' . $member, null, 120);
579: cache_put_data('member_data-normal-' . $member, null, 120);
580: cache_put_data('member_data-minimal-' . $member, null, 120);
581: }
582: cache_put_data('user_settings-' . $member, null, 60);
583: }
584: }


Number 2:
qwertyblarg 12 March 2009, 16:22:46
81.86.72.112  3f0b5807423ca05b927ce72d3cf23c6a
Type of error: Critical
http://www.minus1mod.com/smf/index.php?action=thankyoupostdelete;topic=1648.0;msg=26681;sesc
Wrong value type sent to the database. Integer expected.
Function: updateMemberData
File: /home/minusmod/public_html/smf/Sources/Subs.php
Line: 564


And related code:
544: // Ensure posts, instant_messages, and unread_messages don't overflow or underflow.
545: if (in_array($var, array('thank_you_post_became', 'thank_you_post_made')))
546: {
547: if (preg_match('~^' . $var . ' (\+ |- |\+ -)([\d]+)~', $val, $match))
548: {
549: if ($match[1] != '+ ')
550: $val = 'CASE WHEN ' . $var . ' <= ' . abs($match[2]) . ' THEN 0 ELSE ' . $val . ' END';
551: $type = 'raw';
552: }
553: }
554:
555: $setString .= ' ' . $var . ' = {' . $type . ':p_' . $var . '},';
556: $parameters['p_' . $var] = $val;
557: }
558:
559: $smcFunc['db_query']('', '
560: UPDATE {db_prefix}members
561: SET' . substr($setString, 0, -1) . '
562: WHERE ' . $condition,
563: $parameters
==>564: );
565:
566: updateStats('postgroups', $members, array_keys($data));
567:
568: // Clear any caching?
569: if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2 && !empty($members))
570: {
571: if (!is_array($members))
572: $members = array($members);
573:
574: foreach ($members as $member)
575: {
576: if ($modSettings['cache_enable'] >= 3)
577: {
578: cache_put_data('member_data-profile-' . $member, null, 120);
579: cache_put_data('member_data-normal-' . $member, null, 120);
580: cache_put_data('member_data-minimal-' . $member, null, 120);
581: }
582: cache_put_data('user_settings-' . $member, null, 60);
583: }
584: }


Number 3:
qwertyblarg 12 March 2009, 16:18:13
81.86.72.112  3f0b5807423ca05b927ce72d3cf23c6a
Type of error: Critical
http://www.minus1mod.com/smf/index.php?action=thankyoupostdelete;topic=1648.0;msg=26681;sesc
Wrong value type sent to the database. Integer expected.
Function: updateMemberData
File: /home/minusmod/public_html/smf/Sources/Subs.php
Line: 564


And related code:
544: // Ensure posts, instant_messages, and unread_messages don't overflow or underflow.
545: if (in_array($var, array('thank_you_post_became', 'thank_you_post_made')))
546: {
547: if (preg_match('~^' . $var . ' (\+ |- |\+ -)([\d]+)~', $val, $match))
548: {
549: if ($match[1] != '+ ')
550: $val = 'CASE WHEN ' . $var . ' <= ' . abs($match[2]) . ' THEN 0 ELSE ' . $val . ' END';
551: $type = 'raw';
552: }
553: }
554:
555: $setString .= ' ' . $var . ' = {' . $type . ':p_' . $var . '},';
556: $parameters['p_' . $var] = $val;
557: }
558:
559: $smcFunc['db_query']('', '
560: UPDATE {db_prefix}members
561: SET' . substr($setString, 0, -1) . '
562: WHERE ' . $condition,
563: $parameters
==>564: );
565:
566: updateStats('postgroups', $members, array_keys($data));
567:
568: // Clear any caching?
569: if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2 && !empty($members))
570: {
571: if (!is_array($members))
572: $members = array($members);
573:
574: foreach ($members as $member)
575: {
576: if ($modSettings['cache_enable'] >= 3)
577: {
578: cache_put_data('member_data-profile-' . $member, null, 120);
579: cache_put_data('member_data-normal-' . $member, null, 120);
580: cache_put_data('member_data-minimal-' . $member, null, 120);
581: }
582: cache_put_data('user_settings-' . $member, null, 60);
583: }
584: }


All three criticals happening on line 564. Reading through the code - it has information relating to the thank you mod in there as well.

Hopefully this extra information will help to solve the problem.

Many Thanks

Piers

Rumbaar

Have you tried to remove the thank you mod then, if that is the case.  Or contact the author in this regards?
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Advertisement: