Jump to content

JDevOnline

Members
  • Posts

    54
  • Joined

  • Last visited

Everything posted by JDevOnline

  1. 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 />'; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.