Forum Moderators: coopster
<?php $BoxID=1; //the starting box ID value//connect to MySQL database
mysql_connect('localhost','****username***','****pw***') or die('cannot connect the database');
mysql_select_db('****dbname****');
//start building the table content
define($table_row,10);//10 rows
define($table_c,5);//and 5 coloums, forms 50 boxes
while ($table_row>0)
{
echo ('<tr>');
while ($table_c>0)
{
//query from the Database for each box.
$query=mysql_query("SELECT * FROM ***tablename*** WHERE ID='$BoxID'");
if($query)//determine if the box contain any content
{
$result=mysql_fetch_array($query);
define($url,$result[7])
define($title,$result[1])
define($text,$result[6])
define($img_url,$result[2])
define($imgh,$result[3])
define($imgw,$result[4])
define($expire,$result[8])
echo ('<td width="160" height="150" valign="top"><p align="center" class="emptybox">UniverseBoard Box #$BoxID<br> <a onClick="href=\'$url\'" style="cursor:hand" title="$text" class="BoxTitle">$title<br>
<img src="$img_url" width="$imgw" height="$imgh"><br>
</a><span class="Expire">Expire: $expire</span></td>')
}//for if function
else //the box contains nothing in database
{
echo('<td width="160" height="150" valign="top"><p align="center" class="emptybox">UniverseBoard Box #$BoxID<br><br><br><p align="center" class="emptybox">This box is AVAILABLE<br /><a href="advertise.php" class="emptybox">Order here</a></td>');
}//else
$BoxID++;
$table_c--;
}//for this row of table
echo ('</tr>');
$table_row--;
}
?>