[php]
<?php // Includes include("..."); // Find Highest ID $idquery = "SELECT * FROM `posts` WHERE postid = ( SELECT MAX( postid ) FROM `posts` ) ;"; $idresult = mysql_query($idquery); $idnum=mysql_num_rows($idresult); if($idnum==1){ $pageid = mysql_result($idresult,$i,"postid"); $lowid = $pageid - 3; echo "High: ".$pageid." Low: ".$lowid.""; } else{ echo "Fatal Error. Redirecting.."; header("Location:error/down.php"); } // Echo Posts via While Loop while ($lowid < $pageid){ $query = "SELECT * FROM `posts` WHERE `pageid` = '$pageid'"; $result = mysql_query($query); $head = mysql_result($result,$i,"head"); $content = mysql_result($result,$i,"content"); $date = mysql_result($result,$i,"date"); echo $pageid.": "; echo "There should be content here..
"; echo "".$head."
"; echo "".$content."
"; echo "".$date."
"; $pageid--; } ?>[/php]
So I have this code so far, but I can’t get it working.
It’s supposed to echo out the contents of the database according to the pageid, which is also the incrementing value of the while loop.
The loop is working; its echoing the line breaks and horizontal rules, just no content.
The idea of the script is that it fetches the last 3 posts from a database and presents them on a news feed
Thanks in advance for any help!
- Miiikkeee