Hi,
I'm building a website containing small games (swf-files).
I have created a table in MySQL called "games".
Inside this table are the fields "id" (with auto_increment), "address" (url to the swf-file) and "manual" (description of the game in text).
I've also made a function to load the swf-file in an iframe.
Now I'm a bit stuck.
I want people to be able to click on a link of a game, go to "gamewrapper.php" on which the iframe with the game is loaded. "gamewrapper.php" should be the only "game-playing page" (so that i don't have to create a different page for every game).
But how do I go from this to the hyperlinks of the games?
What should the hyperlink be? Could I use my table (field "id") for this?
like "gamewrapper.php&id=3"?
And if yes, do I need to change my script or anything?
This is my script so far:
<html>
<head>
<title> PHP Workshop 4 - testDb.php </title>
<?php
$db = mysql_connect("localhost","username","password") or die("Unable to connect to MySQL");
mysql_select_db("user_db",$db) or die("Unable to select database");
$query = mysql_query("SELECT address FROM games");
$row = mysql_fetch_array($query, MYSQL_ASSOC);
echo "<a href='{$row['address']}'>Click me!</a>";
echo "<iframe src='{$row['address']}' alt='' />";
?>
</head>
</html>[/I]