Ok so I have a very basic setup for an articles page. The database stores the date format like this: Feb 13th, 2009 What I am trying to pull off is rather simple (i think) but I can't seem to get it right to do what I would like. When the articles are pulled to the news.php page I would like them to be formatted like this: Feb 13th, 2009 > Article #1 > Article #2 Feb 18th, 2009 > Article #1 > Article #2 > Article #3 > Article #4 Feb 22nd, 2009 > Article #1 I am not really sure where I am going wrong. Here is my code and any assistance is appreciated! <?php require('connector/db.inc.php'); $sql = "SELECT date, title FROM articles GROUP BY date"; $res = mysql_query($sql); while($row = mysql_fetch_array($res)){ $date = $row['date']; $title = $row['title']; echo '<h4>' . $date . '</h4>'; $sql_AC = "SELECT id, review, status, source, web FROM articles WHERE title='{$title}', date = '{$date}' AND status='1'"; $res_AC = mysql_query($sql_AC); $row_AC = mysql_fetch_assoc($res_AC); $title = $row['title']; $id = $row['id']; echo '<ul> <li> <a href="article.php?id=' . $id . '">' . $title . '</a> </li> </ul><br><br>'; } ?> PHP: PS: Presently it IS pulling the dates properly, but I now need it to get to loop thru the articles that match that date.
Try changing this in the second query: WHERE title='{$title}', date = '{$date}' to this: WHERE date = '{$date}' With the code you posted above, your output will end up looking like this: Feb 13th, 2009 > Article #1 Feb 18th, 2009 > Article #1 Feb 22nd, 2009 > Article #1 You need to remove the title from the second query to get all of the results.