View Single Post
  #1 (permalink)  
Old March 24th, 2007, 04:23 PM
Putter Putter is offline
Registered User
Join Date: Mar 2007
Location: Hull, , United Kingdom.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Yet more Chapter 4 problems

Can anyone help?...I am nearing the end of my rope!!!

I have adapted the code from pages 111 - 116 for my snooker teams database and cannot get the table to populate with data from my hosted database table. The table header comes back OK but there are no main table cells for the data to populate. I want to get to the stage where I can use links in the table to jump to other pages but cannot get past this hurdle. Can anyone please help ? My code looks like this;

$link = mysql_connect("localhost", "snooker", "password")
or die(mysql_error());
or die (mysql_error());

$query = ("SELECT team_id, team_name, division_id FROM tbl_teams");
$result = mysql_query($query, $link)
or die(mysql_error());
$num_teams = mysql_num_rows($result);

$table_header = <<<EOD
<h2><center>Teams Database</center></h2>
<table width="70%" border="1" cellpadding="2"
       cellspacing="2" align="center">
    <th>Team ID</th>
    <th>Team Name</th>
    <th>Division ID</th>

$table_details = '';
while ($row = mysql_fetch_array($result)) {
  $team_id = $row['team_id'];
  $team_name = $row['team_name'];
  $division_id = $row['division_id'];

  $table_details .=<<<EOD

$table_details .=<<<EOD
   <td>Total :$num_teams Teams</td>

$table_footer = "</table>";

$teams =<<<TEAMS

  echo "There are $num_teams Teams in our database";
  echo $teams;