0
我有一些問題用php左加入MySQL的左連接,錯誤的SQL語法
PHP寫我一個錯誤
您的SQL語法錯誤;檢查手冊中 對應於你的MySQL服務器版本正確的語法使用 附近 'FROM ipb_topics牛逼LEFT JOIN ipb_posts P於p.topic_id = t.tid LEFT JOIN ipb_at' 第12行
和代碼是
$query = mysql_query("
SELECT
t.tid as tid,
t.title as title,
t.start_date as start_date,
t.title_seo as title_seo,
p.post as post,
a.attach_location as attach_location,
FROM ".$forum_prefix."topics t
LEFT JOIN ".$forum_prefix."posts p ON p.topic_id = t.tid
LEFT JOIN ".$forum_prefix."attachments a ON a.attach_rel_id = t.tid
GROUP BY t.tid
") or die(mysql_error());
請不要使用'mysql_ *'功能,它棄用(見[*紅框*](http://php.net/manual/en/function。 mysql-query.php))並且容易受到sql注入的影響。使用[* PDO *](http://php.net/manual/en/book.pdo.php)或[* MySQLi *](http://php.net/manual/en/book.mysqli.php) 。 – alfasin