Page 1 of 1

Calendar Error [Solved]

PostPosted: Fri Feb 09, 2007 6:10 pm
Author: Drop-Forged
Your phpBB Version: 2.0.22
phpBB Type: phpBB / IMPortal
MODs: Yes
Your knowledge: Basic Knowledge
Board URL: http://christiansoldiersgaming.org

PHP Version:
MySQL Version:


What was done before the problem appeared?
Updated from 140


What was done to try to solve the problem?
Nothing yet, not sure where to begin.



De.scription and Message

Here is the error I get when I try to view a date on my sites Calendar:


[align=center:2obfkt7i]Could not obtain topics information

DEBUG MODE

SQL Error : 1064 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 '-3, 47' at line 25

SELECT t.*, p.poster_id, p.post_username, p.enable_bbcode, p.enable_html, p.enable_smilies, u.username, pt.post_text, pt.bbcode_uid, lp.poster_id AS lp_poster_id, lu.username AS lp_username, lp.post_username AS lp_post_username, lp.post_time AS lp_post_time FROM phpbb_topics AS t, phpbb_posts AS p, phpbb_posts_text AS pt, phpbb_users AS u, phpbb_posts AS lp, phpbb_users lu WHERE t.forum_id IN (159, 160, 151, 152, 153, 183, 208, 154, 155, 156, 157, 158, 163, 74, 144, 146, 3, 2, 176, 50, 136, 4, 24, 61, 199, 6, 187, 188, 196, 177, 48, 147, 9, 62, 236, 195, 198, 27, 40, 12, 81, 13, 16, 10, 47, 17, 11, 14, 192, 42, 139, 202, 68, 69, 70, 71, 72, 73, 175, 178, 96, 34, 201, 225, 172, 173, 234, 235, 203, 53, 128, 101, 102, 226, 129, 189, 190, 197, 212, 211, 233, 227, 237, 238, 126, 131, 184, 107, 109, 110, 111, 112, 168, 174, 206, 193, 108, 115, 116, 117, 118, 205, 143, 223, 224, 52, 209, 219, 239, 220, 221, 222, 228, 229, 230, 231, 232, 200) AND p.post_id = t.topic_first_post_id AND pt.post_id = t.topic_first_post_id AND u.user_id = p.poster_id AND lp.post_id = t.topic_last_post_id AND lu.user_id = lp.poster_id AND t.topic_calendar_time <1171515600>= 1171429200 AND t.topic_status <> 2 ORDER BY t.topic_calendar_time, t.topic_calendar_duration DESC, t.topic_last_post_id DESC LIMIT -3, 47

Line : 410
File : functions_calendar.php[/align:2obfkt7i]




Some dates it doesnt get the error, not sure why, the error seems to happen even on dates without topics.




Anyone have any ideas??? <img>

PostPosted: Mon Feb 12, 2007 10:16 pm
Author: Michaelo
I cannot find the code that include LIMIT, please check you have the latest version of functions_calendar.php.
If you are unsure post part of the code from line 371 to line 410
Mike

Re: Calendar Error

PostPosted: Tue Feb 13, 2007 2:09 am
Author: Drop-Forged
Yes, I double checked, it is the one from the IM 141 package.

Here is the code you asked for:

Code: Select all
     $sql = "SELECT                     t.*,                     p.poster_id, p.post_username, p.enable_bbcode, p.enable_html, p.enable_smilies,                     u.username,                     pt.post_text, pt.bbcode_uid,                     lp.poster_id AS lp_poster_id,                     lu.username AS lp_username,                     lp.post_username AS lp_post_username,                     lp.post_time AS lp_post_time                     $sql_forums_field             FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . POSTS_TEXT_TABLE . " AS pt, " . USERS_TABLE . " AS u, " . POSTS_TABLE . " AS lp, " . USERS_TABLE . " lu $sql_forums_file             WHERE                     t.forum_id IN ($s_forum_ids)                 AND p.post_id   = t.topic_first_post_id                 AND pt.post_id  = t.topic_first_post_id                 AND u.user_id   = p.poster_id                 AND lp.post_id  = t.topic_last_post_id                 AND lu.user_id  = lp.poster_id                 AND t.topic_calendar_time <end_date>= $start_date                 AND t.topic_status <TOPIC_MOVED>sql_query($sql)) )     {         message_die(GENERAL_ERROR, 'Could not obtain topics information', '', __LINE__, __FILE__, $sql);     }       // get the number of occurences     $number = $db->sql_numrows($result);       // if limit per page asked, limit the number of results     if ($limit)     {         $sql .= " LIMIT $start, $max_limit";         if ( !($result = $db->sql_query($sql)) )         {             message_die(GENERAL_ERROR, 'Could not obtain topics information', '', __LINE__, __FILE__, $sql);

PostPosted: Tue Feb 13, 2007 3:05 am
Author: Michaelo
Check your events, recurring events and birthdays and see if someone entered a birthday or event using a negative number (-3)...

I have managed to reproduce the error by artificially introducing an error... now I will try find the cause... but I suspect...

After you have check events for incorrect information... try this...

[code]  OPEN]

Now check again and if it works check to see your events are still showing...
Mike

Re: Calendar Error

PostPosted: Thu Feb 15, 2007 11:06 pm
Author: Drop-Forged
Sorry for my delayed response.

Unfortunately adding that code doesnt seem to help.

I did check, and I seem to have other negative numbers as well, from what I can see in the topic_poster field.

But I have a really hard time doing much in phpMyAdmin with this DB, it is around 80MB and phpMyAdmin is really slow, and unreliable with it.

Should I replace these negative numbers with positives in my DB, or will that cause other issues???

PostPosted: Fri Feb 16, 2007 7:21 am
Author: Michaelo
Don't replace anything... just delete cache... I am not even sure if the function requires positive numbers at this point... However any time you pass it a negative number it generates the error... The code will eliminate ant negative numbers being passed to the function so it's worth a try (after you delete cache ACP -> IM Portal -> delete cache + any other cache)...
Mike

Re: Calendar Error

PostPosted: Fri Feb 16, 2007 11:57 am
Author: Drop-Forged
After a few hours of trial and error, I finally got it to workà¢Ãƒ ¢Ã¢â‚¬Å¡Ã‚ ¬Ãƒâ€šÃ‚ ¦ :D

PostPosted: Fri Feb 16, 2007 2:36 pm
Author: Michaelo
No worries :-?

Re: Calendar Error [Solved]

PostPosted: Sat Dec 13, 2008 5:39 am
Author: shentrax
I had to put
Code: Select all
if ($local_start < 0) $local_start = 1;

in both places for it to work, just a fyi.
Code: Select all
// topics$topics_count = 0;$remaining = $board_config['topics_per_page'] - $displayed;$local_start = $start-$displayed;if ($local_start < 0) $local_start = 1;get_event_topics($events, $topics_count, $start_date, $end_date, true, $local_start, $remaining, $fid);// recurring events$remaining = $board_config['topics_per_page'] - $displayed;$local_start = $start-$displayed;if ($local_start < 0) $local_start = 1;get_recurring_events($events, $topics_count, $start_date, $end_date, true, $local_start, $remaining, $fid, true);//// set the page title and include the page header


but it works, thanks.