I can draw this for better understanding:
Webpage:
Category Title # of Plays
=================================================================
Advertisement
Flash Game
Advertisement
=================================================================
Game Instructions Controls
Ok so the example above is the layout I have. My problem is, when I paste the PHP code in the page, I am pasting right where the Flash Game is placed. The category text, title text, # of plays text, games instruction text and control text show up bundling with the flash game in the middle. All the text are stuck together inside one area with the flash game. I can't separate the echos to where they belong. I'm afraid if I take out the echo's within the PHP, the code will stop working. Here is an example of the code I have:
=============================
Code: Select all
<?php
if(isset($_GET['id'])) {
$conn = mysql_connect("host", "username", "password");
mysql_select_db("games");
$game_id = $_GET['id'];
$sql = "SELECT * FROM games WHERE id='$game_id' LIMIT 1";
$result = mysql_query($sql, $conn) or die(mysql_error());
$number_of_results = mysql_num_rows($result);
while ($result_array = mysql_fetch_array($result, MYSQL_ASSOC)) {
$id = $result_array['fldID'];
$title = $result_array['fldTitle'];
$iconsmall = $result_array['fldIconSmall']; // Example: game1234.png
$instructions = $result_array['fldInstructions'];
$controls = $result_array['fldControls'];
$swf = $result_array['fldSwfSrc']; // Example: game1234.swf
$iconsmall_file_location = 'http://www.blabla.com/games/images/' . $iconsmall;
$swf_file_location = 'http://www.blabla.com/games/' .$swf;
echo '<a href="http://www.blabla.com/games.php?id=' . $id . '"></a>';
echo '<h1>' . $title . '</h1>';
echo '<h1>' . $instructions . '</h1>';
echo '<h1>' . $controls. '</h1>';
echo '<img src="' . $iconsmall_file_location . '" width="50" height="50" border="0" />';
echo '<object width="550" height="400">';
echo '<param name="movie" value="' . $swf_file_location . '">';
echo '<embed src="' . $swf_file_location . '" width="550" height="400">';
echo '</embed>';
echo '</object>';
}
} else {
$sel2 = mysql_query("SELECT * FROM games");
if(!$sel2) {
echo "sorry could not get list of current games: " .mysql_error();
exit();
}
while($row = mysql_fetch_assoc($sel2)) {
echo "
Play " .$row['title']. "<a href='index.html?id=".$row['id']."'>Here</a>";
}
}
?>
=============================
I don't know how to take out the echos within the PHP script above, and place them in Category, Title, # of Plays, Game Instructions and Controls area, because HTML is surrounding those areas.