First, on the Javascript which is actually JQuery… Open a new post on this as it is a new topic.
On it, though, the best way would be to use a DIV and lock that into one size using CSS.
Then, put put your data into it. Use the CSS to set the max size and scrolling. Just use JS/JQ to
load the data into it. Don’t use the JS/JQ to set the DIV’s settings. (That will lock in the box.)
Now, back to the display code. I took a little time to peek into how to create a grid using the
“row” data from a database. If you use a WHILE command, you have to do some complicated
counting system to be able to tell when to create a new row of the grid. So, I came up with a
more simpler version. This sticks to the two FOR’s that we had before. And, it takes out the
WHILE completely as it is not needed. Looking into how the reading of a row from a database
actually works (Never had to before.), I found that each time you grab a row of data, it does an
auto-increment in the database’s internal row-counter. So, that is great for your display. You just
have to place the command inside your FOR loops and you are all set. So, here is the next sample
to try. Hope it works… (Did not have time to create a test database to test it here!) Let me know…
[php]
"; // Start the table (Border for now so we can see if it is working correctly...) echo "
";
// Check if there is a file. If not, leave an empty cell, if there is one, display it
if (isset($game)){
// First get the name without the extension
echo $game["name"] . "'s filename is: " . $game["file"] . " "; // Set up HREF to point to HTML code for the entire table cell (any click inside will go there) echo ""; // Display the picture (inside the anchor to the html file) echo " "; // Show the name of the game echo "" . $game["name"] . ""; } else { // Display whatever for a blank cell echo "New Game Coming Soon!"; } // End the cell no matter if empty or not echo " | ";
}
echo "
[/php]
Notice that I changed from loading the row of data as an array and used the “ASSOCIATED” version
instead. This allows the use of the field names instead of using numbers. A mistake in the previous
version. Works easier for your display…