On one of my PHP pages, I build a table using the following code snippet:
Expand|Select|Wrap|Line Numbers
- <?php
- echo "<table><THEAD><tr>";
- echo "<td><b>Incident</b></td>";
- echo "<td><b>Facility</b></td>";
- echo "<td><b>Location</b></td>";
- echo "<td><b>Person</b></td>";
- echo "<td><b>Injury</b></td>";
- echo "<td><b>Severity</b></td>";
- echo "<td><b>Incident Date</b></td></tr></THEAD>";
- while ($myrow = mysql_fetch_array($result))
- {
- echo "<TBODY><tr><td>".$myrow["incident_id"]."</td>";
- echo "<td>  ".$myrow["fac_id"]."</td>";
- echo "<td>  ".$myrow["room_descr"]."</td>";
- echo "<td>  ".$myrow["person_type"]."</td>";
- echo "<td>  ".$myrow["injury"]."</td>";
- echo "<td>  ".$myrow["severity"]."</td>";
- echo "<td>  ".$myrow["inc_date"]."</td>";
- }
- echo "</tr></TBODY></table>";
- ?>
I worked around this on one file by jumping out of php and coding the html <table> arguments and then jumping back into php to echo the data, but there must be a better way to do this.
Is there a way to enter the table arguments within php? I want something like
Expand|Select|Wrap|Line Numbers
- <table border name='Mytable class'='sortable'>
jej1216