I have a table in my database names Classes, which stores, pretty obviously the classes that I have taken. the fields are department, course, name, description, and semester. I am trying to run a query to display the courses. Eventually I will have a drop down box to change the query based on the semester. Anyways, after the query i want to dump the info into a table, that im generating with php. I have the part down with using a for loop so i can pull each row out of the database and put it into a separate row in the html table. What I am having trouble with is getting the info out of the array from the query.
Heres what I have going so far, that only works to give me a empty table. Im kind of stuck now.
<?php
//Database Info
$host="mysql.wiu.edu:****";
$user="****";
$password="******";
$database="mydb";
$connection = mysql_connect($host,$user,$password) or die ("Could Not Connect to the server.");
$db = mysql_select_db($database,$connection) or die ("Could Not Connect to the database.");
$sql = "SELECT * FROM Classes WHERE semester = '2'";
$query = mysql_query($sql) or die ("Couldn't Execute Query");
$row = mysql_fetch_array($query,MYSQL_NUM);
ECHO "<table>\n";
extract($row);
for ($i=0;$i<=6;$i++)
{
ECHO "<tr>\n";
ECHO "<td>$dept[$i]</td>\n";
ECHO "<td>$crse[$i]</td>\n";
ECHO "<td>$name[$i]</td>\n";
ECHO "<td>$description[$i]</td>\n";
ECHO "<td>$semester[$i]</td>\n";
ECHO "</tr>\n";
}
ECHO "</table>";
?>