not sure if this is where to post this but here it goes...
ok i have a page here that i want all of the things on it to be held in a database that way it is eaiser to edit and add to...
i currently have a sample going which is here and i need some help.
i have two tables in my data base...
one called games_divisions and other games_schedule
in the games_divisions table i have....
divID int(10) UNSIGNED No auto_increment
name varchar(128) Yes NULL
and in games_schedule i have....
divID int(10) UNSIGNED No auto_increment
name varchar(128) Yes NULL
date varchar(128) Yes NULL
field varchar(128) Yes NULL
game varchar(128) Yes NULL
time varchar(128) Yes NULL
i want to use this code to be able to have it come out in that table form...
here is my code:
<?
$dbh=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database.');
mysql_select_db ("databasename");
$query = "select * from games_schedule where name = \"".$group."\"";
$result = mysql_query($query);
?>
<div align="center">
<table border="1" cellpadding=3 cellspacing=3>
<TR>
<TD colspan=6 Align=center><b><? echo $group ?></b></td>
</tr>
<tr>
<td bgcolor="#808080">Time/Field</td>
<?
$num_divs = mysql_num_rows($result);
for($i=0; $i <5; $i++)
{
$currentDiv = mysql_fetch_array($result);
echo "<td bgcolor=#808080 align=center>".$currentDiv["date"]."</td>";
}
?>
</tr>
<tr>
<?
$query = "select * from games_schedule where name = \"".$group."\"";
$result = mysql_query($query);
$num_divs = mysql_num_rows($result);
echo "<td>".$currentDiv["time"]."</td>";
for($i=0; $i <5; $i++)
{
$currentDiv = mysql_fetch_array($result);
echo "<td>".$currentDiv["game"]."</td>";
}
?>
</tr>
<tr>
<?
echo "<td>".$currentDiv["time"]."</td>";
for($i=0; $i <5; $i++)
{
$currentDiv = mysql_fetch_array($result);
echo "<td>".$currentDiv["game"]."</td>";
}
?>
</tr>
</table>
</div>
if there is a better way to set this up that would be appricated...
Thanks
~Ecks