[EventCalendar] 3.0.4 iCal DB corruption?

Jim Galley jim.galley at gmail.com
Thu Oct 12 14:39:49 UTC 2006


Thanks Darrell.

>Been a while since I looked at 3.0.4...look for line 1157.
>
>    $calendar_entries = $wpdb->get_results(
>       "SELECT
>            p.id as id,
>            post_title,
>            post_excerpt,
>            DATE_FORMAT(post_date_gmt,'%Y%m%dT%H%i%sZ') as dt_start,
>            $user_nicename
>          FROM $tableposts p, $tablepost2cat p2c
>          LEFT JOIN $tableusers u
>            ON u.ID=p.post_author
>          WHERE post_status = 'publish'
>            AND p.id = post_id
>            AND category_id = $ec3->event_category"
>     );
>
>I think Alex wants you to change the query to:
>
>    $calendar_entries = $wpdb->get_results(
>       "SELECT
>            p.id as id,
>            post_title,
>            post_excerpt,
>            DATE_FORMAT(post_date_gmt,'%Y%m%dT%H%i%sZ') as dt_start,
>            $user_nicename
>          FROM $wpdb->posts p,
>          LEFT  JOIN $wpdb->users u ON p.post_author=u.ID
>          INNER JOIN $wpdb->post2cat p2c ON p.id=p2c.post_id
>            AND p2c.category_id=$ec3->event_category"
>     );
>
>
>Hopefully I interpreted the Alex's request correctly.

I made the above change and got the following response from
http://troop565.org/?ec3_vcal

------------------------------------------------------------------
BEGIN:VCALENDAR
VERSION:2.0
X-WR-CALNAME:Troop565SmithtownNY
<div id='error'>
			<p class='wpdberror'><strong>WordPress database error:</strong>
[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 &#039;LEFT  JOIN wp_users u ON p.post_author=u.ID
          INNER JOIN wp_post2cat p2c&#039; at line 8]<br />
			<code>SELECT
            p.id as id,
            post_title,
            post_excerpt,
            DATE_FORMAT(post_date_gmt,&#039;%Y%m%dT%H%i%sZ&#039;) as dt_start,
            user_nicename
          FROM wp_posts p,
          LEFT  JOIN wp_users u ON p.post_author=u.ID
          INNER JOIN wp_post2cat p2c ON p.id=p2c.post_id
            AND p2c.category_id=2</code></p>
			</div>END:VCALENDAR
------------------------------------------------------------------

Is this because wp_post2cat ($wpdb->post2cat) isn't declared in the
FROM statement?



More information about the EventCalendar mailing list