Hi all,
I'm basically in the process of developing a largely dependent php/mysql site. As I'm progressing through each section, I'm wondering if my approach could be changed for more efficiency. I'm not sure if you're allowed to mention site names here but
www.jammyjunction.com/games.php gives a good idea of the sort of layout to be used throughout the site. So, my approach:
<div class="listings">
<table width="550" border="1" cellpadding="0" cellspacing="0" bordercolor="#7B868E" align="center" >
<tr>
<?php
include "database.php";
$query="SELECT * FROM games order by date desc";
$result = mysql_query($query)
or die ("Couldn't execute query");
while ($row=mysql_fetch_array($r
esult)){
echo"<td width='50%' bgcolor=$colour>
<div id='info'><h2>{$row['title
']}</h2></
div>
<a href='play.php?title={$row
['title']}
&file={$ro
w['filenam
e']}'>
<img src=media/{$row['picfile']
} border='0'><div id='write'></a>
{$row['descrip']}</div>
</td>";
}
?>
</table>
I've left out some functions and other such frills as not to bombard you all with code. I just found that the php pages usually hang for a while before loading. Any suggestions? I remember reading something about tables have to be populated before anything is diplayed? Maybe the include statement is called too many times?
Also, to display a game, I use the $_GET array as one can see from above,play.php is called with e.g. play?title=gamename&file=f
ilename.sw
f. From here, play.php extracts this and plays it.
In the MySql database there is a table corresponding to each type of file i.e.videos, animations,games as to seperate the surge or queries.
Thanks in advance
Start Free Trial