Hi,
I am trying to draw a HTML table with mysql data using loop. The code below is drawing html tables fine, but is not drawing multiple rows, showing just 1 row per table (image attached student.father.jpg). Can anyone please help me do what I am trying to do:
Mysql table structure:
id, sname, fname, foccup, fimp
id=id, sname=student's name, fname=father's name, foccup=father's occupation, fimp(Y/N)=father's occupation important
My Code:
$query = "select sname, fname, foccup from nroll where fimp = 'Y' group by foccup order by foccup asc";
$result = mysql_query($query);
$rows = mysql_num_rows($result);
while($rows = mysql_fetch_array($result)){
echo '<table border="1"><tr><td colspan="3">' . $rows[foccup] . '</td></tr>';
echo '<tr><td>' . $rows[sname] . '</td><td>' . $rows[fname] . '</td></tr>';
echo '</table><br />';
}