I seem to be having a problem getting this while() loop to work...
include("database_connect.php");
$query = "SELECT id, title, date FROM entries";
$result = mysql_query($query);
while ( $result = mysql_fetch_assoc($result) ) {
$id = $result["id"];
$title = $result["title"];
$date = $result["date"];
echo "<div class=\"recent_entries\">";
echo "<a href=\"archives.php?id=" . $id . "\">" . $title . "</a><br>";
echo "<div class=\"date_line\">Posted on " . $date . "</div>";
echo "</div>";
}
I have checked the database connection and it is working, the SQL statement is correct (tested in phpMyAdmin), and all of the field names from the associative array are correct.
There are two records in the database, and mysql_num_rows($result) returns both records.
The while() loop is returning only the first row, and I need it to return multiple rows...
Any help would be fantastic!!