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 '= echo do_format('b_id'); ?> ORDER BY c_time ASC' at line 1 Failed query: SELECT * FROM rate_blog_comments LEFT JOIN rate_members ON m_id=c_user LEFT JOIN rate_pictures ON (i_user=m_id AND i_status=2) WHERE c_post= echo do_format('b_id'); ?> ORDER BY c_time ASC