Доброе утро специалистам !
Есть код
$sql = "
SELECT SQL_CACHE
f.cat_id, f.forum_id, f.forum_status, f.forum_parent, f.show_on_index,
p.post_id AS last_post_id, p.post_time AS last_post_time,
t.topic_id AS last_topic_id, t.topic_title AS last_topic_title,
u.user_id AS last_post_user_id, u.user_rank AS last_post_user_rank,
IF(p.poster_id = $anon, p.post_username, u.username) AS last_post_username
FROM " . BB_CATEGORIES . " c
INNER JOIN " . BB_FORUMS . " f ON($forums_join_sql)
$join_p_type " . BB_POSTS . " p ON($posts_join_sql)
$join_t_type " . BB_TOPICS . " t ON($topics_join_sql)
LEFT JOIN " . BB_USERS . " u ON(u.user_id = p.poster_id)
ORDER BY c.cat_order, f.forum_order
";
$replace_in_parent = array(
'last_post_id',
'last_post_time',
'last_post_user_id',
'last_post_username',
'last_post_user_rank',
'last_topic_title',
'last_topic_id',
);
В логах ошибка:
#001064 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 '.cat_id, f.forum_id, f.forum_status, f.forum_parent, f.show_on_index, p.post_i' at line 2
SELECT SQL_CACHE f.cat_id, f.forum_id, f.forum_status, f.forum_parent, f.show_on_index, p.post_id AS last_post_id, p.post_time AS last_post_time, t.topic_id AS last_topic_id, t.topic_title AS last_topic_title, u.user_id AS last_post_user_id, u.user_rank AS last_post_user_rank, IF(p.poster_id = -1, p.post_username, u.username) AS last_post_username FROM bb_categories c INNER JOIN bb_forums f ON(f.cat_id = c.cat_id) LEFT JOIN bb_posts p ON(p.post_id = f.forum_last_post_id) LEFT JOIN bb_topics t ON(t.topic_last_post_id = p.post_id) LEFT JOIN bb_users u ON(u.user_id = p.poster_id) ORDER BY c.cat_order, f.forum_order
Подскажите, что не так ?
За ранние спасибо!