PDA

View Full Version : Selecting Rows With Same Column


paul41598
01-22-2007, 03:46 PM
How would it work if I needed to select 2 rows with the same column name? For instance:

$getthreads = $db->query_read("
SELECT forum.forumid, forum.title, thread.*
FROM ".TABLE_PREFIX."thread AS thread
LEFT JOIN ".TABLE_PREFIX."forum AS forum ON(thread.forumid = forum.forumid)
");


while($thread = $db->fetch_array($getthreads))
{

$forum['title'] = $thread['title'];

$thread['title'] = fetch_censored_text(fetch_trimmed_title(unhtmlspec ialchars($thread['title']), 22));

}

$forum[title] when used in a template will grab the thread title, and not the forum title.

How can I distinguish between the two if possible? :p



n/m gotta use aliases ;)