atika90 Posted March 18, 2011 Share Posted March 18, 2011 how i want to display data from database to look like this : <table width="633" height="224" border="1"> <tr bgcolor="#999900"> <td width="45">Bil</td> <td width="121">Course_name</td> <td width="83">session</td> <td width="83">start_date</td> <td width="83">end_date</td> <td width="83">notes</td> <td width="89">pre-req</td> </tr> <tr bgcolor="#6A7AEA"> <td rowspan="2">1.</td> <td rowspan="2" bgcolor="#6A7AEA">Math</td> <td>1st session </td> <td>1 jan 11 </td> <td>6 jan 11 </td> <td rowspan="2"> </td> <td rowspan="2"><image icon that will link to the oter site> </td> </tr> <tr> <td bgcolor="#6A7AEA">2nd session </td> <td bgcolor="#6A7AEA">8 jan 11 </td> <td bgcolor="#6A7AEA">15 jan 11 </td> </tr> <tr> <td bgcolor="#0066CC">2.</td> <td bgcolor="#0066CC">English</td> <td bgcolor="#0066CC">1st session </td> <td bgcolor="#0066CC">1 feb 11 </td> <td bgcolor="#0066CC">6 feb 11 </td> <td bgcolor="#0066CC"> </td> <td bgcolor="#0066CC"><image icon that will link to the oter site></td> </tr> <tr> <td rowspan="2" bgcolor="#6A7AEA">3.</td> <td rowspan="2" bgcolor="#6A7AEA">Science</td> <td height="29" bgcolor="#6A7AEA">1st session </td> <td bgcolor="#6A7AEA">8 march 11 </td> <td bgcolor="#6A7AEA">15 march 11 </td> <td rowspan="2" bgcolor="#6A7AEA"> </td> <td rowspan="2" bgcolor="#6A7AEA"><image icon that will link to the oter site></td> </tr> <tr> <td bgcolor="#6A7AEA">2nd session</td> <td bgcolor="#6A7AEA">16 march 11 </td> <td bgcolor="#6A7AEA">21 march 11 </td> </tr> </table> ** all the view data is called from database including the icon image thanks... Quote Link to comment https://forums.phpfreaks.com/topic/230988-display-data-from-database-in-table-form/ Share on other sites More sharing options...
Eyewash01 Posted March 18, 2011 Share Posted March 18, 2011 <?php $sql = "SELECT * FROM stuff;"; $rs = mysql_query($sql); while ($row = mysql_fetch_array($rs)){ extract ($row); echo '<td>'.$example_field_name1.'</td>'; echo '<td>'.$example_field_name2.'</td>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/230988-display-data-from-database-in-table-form/#findComment-1189036 Share on other sites More sharing options...
atika90 Posted March 19, 2011 Author Share Posted March 19, 2011 what is the fuction of line: extract ($row); Quote Link to comment https://forums.phpfreaks.com/topic/230988-display-data-from-database-in-table-form/#findComment-1189418 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.