tnl2k7
Banned
- Messages
- 3,131
- Reaction score
- 0
- Points
- 0
Right then here goes,
I've got a MySQL database running as the backend for my arcade. It contains one table, named 'games' with two columns, one called 'name' and one called 'type'. The 'name' column is the primary key. All the data for the arcades game names and locations are stored within this table.
Example, a game called Alien Abduction in Shockwave format would have an entry in the name column as 'Alien-Abduction' and in the type column 'dcr'. The page it would be embedded on would be 'http://www.productivityzero.uk.to/play.php?id=Alien-Abduction'.
Now though, I'm a little bit annoyed. I want to echo the 5 latest games uploaded to the site. But because of the lack of a time / date column I can't see a way of doing it. Everything in the MySQL table seems to be in the order I uploaded it, with the latest games being shown at the bottom of the records list in phpMyAdmin.......if that helps.
The code I'm using to show all the games is this:
So I'm hoping to be able to use something similar in order to perform this task.
All the pages are automatically generated, I don't really want this one to be an exception. Any ideas, experts?
If you need any more information, just ask and I'll update this post.
Thanks,
Luke.
I've got a MySQL database running as the backend for my arcade. It contains one table, named 'games' with two columns, one called 'name' and one called 'type'. The 'name' column is the primary key. All the data for the arcades game names and locations are stored within this table.
Example, a game called Alien Abduction in Shockwave format would have an entry in the name column as 'Alien-Abduction' and in the type column 'dcr'. The page it would be embedded on would be 'http://www.productivityzero.uk.to/play.php?id=Alien-Abduction'.
Now though, I'm a little bit annoyed. I want to echo the 5 latest games uploaded to the site. But because of the lack of a time / date column I can't see a way of doing it. Everything in the MySQL table seems to be in the order I uploaded it, with the latest games being shown at the bottom of the records list in phpMyAdmin.......if that helps.
The code I'm using to show all the games is this:
Code:
<?php
include("shared/script/mysql-connect.php");
$result = mysql_query("SELECT * FROM games ORDER by name ASC") or die(mysql_error());
echo("<h3>content...</h3>");
while($row = mysql_fetch_array( $result )) {
$link = str_replace("-"," ",$row['name']);
echo "<p><a href=\"play.php?id=";
echo $row['name'];
echo "\">";
echo $link;
echo "</a></p>";
}
?>
So I'm hoping to be able to use something similar in order to perform this task.
All the pages are automatically generated, I don't really want this one to be an exception. Any ideas, experts?
If you need any more information, just ask and I'll update this post.
Thanks,
Luke.
Last edited: