I'm trying to do a blog script for my site from scratch, and I have the tables set up the way I want them and everything, but on my main page, when I put "LIMIT 0, 5", it's only returning 1 entry. here is my code:
<?
$db = mysql_connect("localhost", "root", " ");
mysql_select_db("stupid5p_blog",$db);
$result = mysql_query("SELECT * FROM `blog` ORDER BY `id` DESC LIMIT 0, 5",$db);
$myrow = mysql_fetch_array($result);
$body = $myrow["body"];
$str = $myrow["date"]; /* your date */
$pattern = "([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})";
ereg( $pattern, $str, $regs);
/*
$regs[1]:year
$regs[2]:month
$regs[3]:day
*/
$newdate = $regs[2]."-".$regs[3]."-".$regs[1];
{
echo "<div class=\"datebox\">";
echo $myrow["title"];
echo "</div>";
echo "<font size=\"-2\">";
echo "<b>";
echo "Now Playing: ";
echo "</b>";
echo $myrow["playing"];
echo "<br>";
echo "<b>";
echo "Mood: ";
echo "</b>";
echo $myrow["mood"];
echo "</font>";
echo "<div class=\"body\">";
echo $body = str_replace("\n", "<br>", $body);
echo "</div>";
echo "<div class=\"bottomline\">";
echo $newdate;
echo " - ";
echo $myrow["time"];
echo " - ";
echo $myrow["author"];
echo " - ";
echo "<a href=\"comments.php?id=".$myrow["id"]."\">";
echo "comments";
echo "</div>";
echo "<p>";
}
?>
Can somebody please help?