I'm only doing it to retrieve the last 5 items added to a MySQL table, then the the 5 highest rated... the rest is all HTML.
The code I'm using for the latest entries is:
Code:
$result = mysql_query('SELECT * FROM games ORDER BY id DESC LIMIT 5') or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
$link = str_replace("-"," ",$row['name']);
echo "<li><a href=\"play.php?id=";
echo $row['name'];
echo "\">";
echo $link;
echo "</a></li>";
and for the highest rated entries I'm using:
Code:
include("shared/script/mysql-connect.php");
$result = mysql_query('SELECT * FROM games ORDER BY rating + 0 DESC LIMIT 5') or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
$link = str_replace("-"," ",$row['name']);
echo "<li><a href=\"play.php?id=";
echo $row['name'];
echo "\">";
echo $link;
echo "</a> - Rating: ";
echo $row['rating'];
echo "</li>";
}
I think I'll give up and just have all static files, this is really starting to irritate me bigtime now. I was doing this for ease of editing later but it seems to have gone horribly wrong lol.
Thanks guys, I know I'm a noob and probably the world's most annoying person but this is driving me insane,
-Luke.