10-04-2007, 16:49
|
#4 (permalink)
|
|
I like code.
Join Date: Dec 2004
Location: Chesapeake, VA
Posts: 237
|
You can try something like this
Code:
<?php
$dbh = mysql_connect("host", "user", "pass") or die("Could not connect to MySQL Server");
mysql_select_db("db");
$r = mysql_query("SELECT id,title,content FROM posts ORDER BY id DESC");
while($o = mysql_fetch_array($r)) {
$id = $o['id'];
//Display your post
$r2 = mysql_query("SELECT title,comment FROM comments WHERE post_id = '$id'");
while($o2 = mysql_fetch_array($r2)) {
//Display it's comments
}
}
?>
Last edited by Cborrow : 11-04-2007 at 22:32.
|
|
|
|