in want to display PHP query results in a table?

retlav

New member
I am trying to display the results of a query in the form of a table. this it the PHP that i am using below. The problem is that the headings of the table repeats. I really don't want that...

I am also trying to get a border around the cells of the table, but i get an error when i add table properties

Can someone help me please.

<?php

if ( isset( $_GET['id'] ) )
{

$query = "SELECT * FROM schedule WHERE course_id = '". $_GET['id'] ."' ORDER BY indexx ASC";

$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);


if ($numrows == 0)
{
echo "This course does not have a set schedule. ";

}

$q .= " limit $s,$limit";
$result = mysql_query($query) or die("Couldn't execute query");

while ($row= mysql_fetch_array($result))
{
$indexx = $row["indexx"];
$semester = $row["semester"];
$day = $row["day"];
$time = $row["time"];
$instructor = $row["instructor"];
$location = $row["location"];


echo "<table>";
echo "<tr>";
echo " <td>Index</td>";
echo "<td>Semester</td>";
echo "<td>Day</td>";
echo "<td>Time</td>";
echo "<td>Instructor</td>";
echo "<td>Location</td>";
echo "</tr>";
echo "<tr>";
echo "<td>$indexx</td>";
echo "<td> $semester</td>";
echo "<td>$day</td>";
echo "<td>$time</td>";
echo "<td>$instructor</td>";
echo "<td>$location</td>";
echo "</tr>";
echo"</table>";




$count++ ;

} // end WHILE

echo "<br/>End test link<br/>";
} // end IF


?>
 
Back
Top