Image

Imagerichardm wrote in Imagephp

This may seem stupid, but it's been awhile since i've done anything beyond the basics in SQL..

I have two tables one of topics, and one of users I want it to display all topics, and the information according to that topic plus the author's name (not id).. I wrote out:

SELECT forum_titles.topic_id, forum_titles.author_id, forum_titles.title,
DATE_FORMAT(forum_titles.time_last, '%l:%i%p %b %d') as timelast,
forum_titles.allowed, forum_titles.type, user_account.id, user_account.name
FROM user_account, forum_titles
WHERE allowed IS null OR allowed = \"$user\" AND forum_titles.author_id = user_account.id
ORDER BY timelast DESC LIMIT $s, $e;

to diplay it i used..

while ($row = mysql_fetch_object($rowsql)) {

$topicid = $row->topic_id;
$authorid = $row->author_id;
$author = $row->name;
$title = $row->title;
$timelast = $row->timelast;
$type = $row->type;

echo "$type\n";
echo "a href=\"view_profile.php?id=$authorid\"$author>";
echo "a href=\"show_forum.php?tid=$topicid\"$title";
echo "$timelast\n";

}

Where $rowsql is obviously my SQL statement.. It works sort of.. it displays all the topics but it displays the topic multiple times.. it displays it for each author in the user_account table.. I feel like I'm missing one thing and it's on the tip of my tongue but I just can't get it.