Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi
I have one more problem
I have 2 tables:
Articles with fields aid, title, intro, content, timestamp
and
Comments with fields commentid, aid, poster, content, timestamp
Now, I want to print out titles of recently commented articles (unique).
Here is what I have so far:Code: Select all
<ul>
<? $result = mysql_query("SELECT DISTINCT aid FROM comments ORDER BY commentid DESC LIMIT 0, 10") or die(mysql_error());
while($row = mysql_fetch_array($result)) {
$caid = $row['aid'];
$art= mysql_query("SELECT title FROM articles WHERE aid='$caid'");
$clanek = mysql_fetch_row($art);
$title= $art[0];
?>
<li><a href="<? echo $row['aid']; ?>-a.html"><? echo stripslashes($title); ?></a></li>
<? } ?>
</ul>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]