[feature/attach-dl] Use table aliases in all three cases.

PHPBB3-11042
This commit is contained in:
Andreas Fischer 2012-08-07 00:31:18 +02:00
parent 2d32164fb0
commit 862502aacd

View file

@ -164,18 +164,18 @@ $attachments = ($topic_id || $post_id) ? array() : false;
// $download_id, $post_id, $topic_id // $download_id, $post_id, $topic_id
if ($download_id) if ($download_id)
{ {
$sql = 'SELECT attach_id, in_message, post_msg_id, extension, is_orphan, poster_id, filetime $sql = 'SELECT a.attach_id, a.in_message, a.post_msg_id, a.extension, a.is_orphan, a.poster_id, a.filetime
FROM ' . ATTACHMENTS_TABLE . " FROM ' . ATTACHMENTS_TABLE . " a
WHERE attach_id = $download_id"; WHERE a.attach_id = $download_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$attachment = $db->sql_fetchrow($result); $attachment = $db->sql_fetchrow($result);
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }
else if ($post_id) else if ($post_id)
{ {
$sql = 'SELECT attach_id, in_message, post_msg_id, extension, is_orphan, poster_id, filetime $sql = 'SELECT a.attach_id, a.in_message, a.post_msg_id, a.extension, a.is_orphan, a.poster_id, a.filetime
FROM ' . ATTACHMENTS_TABLE . " FROM ' . ATTACHMENTS_TABLE . " a
WHERE post_msg_id = $post_id"; WHERE a.post_msg_id = $post_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$attachments = $db->sql_fetchrowset($result); $attachments = $db->sql_fetchrowset($result);