Can anyone please throw some light on my problem? I've been working through the Sitepoint "Build Your Own Database Driven Web Site Using PHP & MySQL" book and have hit a snag:-
The following works as expected in the database using PHPMyAdmin:
$result = mysql_query ("select competition.name, competition.competitiondate, competition.starttime, course.name from competition inner join competitioncourse on competition.id=competitionid inner join course on courseid=course.id");
however, the following code displays the headers but does not display the data when inserted into a php page:
echo "<table border='0' align='center'>";
echo "<tr><font size='2'><b> <th width = '300'>Name</th> <th width='100'>Date</th> <th width='80'>Time</th> <th width='100'>Course</th></b></tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><font size='2'><td align='center'>";
echo $row['competition.name'];
echo "</td><td>";
echo $row['competition.competitiondate'];
echo "</td><td align='center'>";
echo $row['competition.starttime'];
echo "</td><td align='center'>";
echo $row['course.name'];
echo "</td></tr>";
}
echo "</table>";
?>
Thanks in advance


Reply With Quote






Bookmarks