html - How to have title columns for each PHP column result -
i individual column titles display each table data column echo'd?
<form> <?php $numerooption= $_post['numero']; $roomtype= $_post['roomtype']; $selectoption = $_post['parkname']; $query = "select * `rooms` `capacity` < '$numerooption' , `park` '$selectoption%' , `dataprojector` '$proj_check%' , `whiteboard` '$white_check%' , `ohp` '$ohp_check%' , `wheelchairaccess` '$wheel_check%' , `lecturecapture` '$cap_check%' , `style` '$roomtype%'"; $result = mysql_query($query); if ($result == false) die ("could not execute statement $query<br />"); echo "<form action='' method='post'>"; echo "<table>"; while($row = mysql_fetch_array($result)){ echo "<tr><td>" . $row['roomcode'] . "</td>"; echo "<td>" . $row['style'] . "</td><td>" . $row['dataprojector'] . "</td>"; echo "<td>" . $row['whiteboard'] . "</td><td>" . $row['ohp'] . "</td>"; echo "<td>" . $row['wheelchairaccess'] . "</td>"; echo "<td>" . $row['lecturecapture'] . "</td>"; echo "<td><input type='radio' name='radioselect' value= '". $row['roomcode']."'></td>"; } echo "<input type='submit' name='ttroom' id='ttroom' name='ttroom'>"; echo "</tr>"; echo "</table>"; echo "</form>";
i'm not sure if understand problem, think solution simply, create header row before while condition. it's say:
... echo "<table>"; echo '<tr>'; echo '<th>title 1</th>'; echo '<th>title 2</th>'; echo '<th>title 3</th>'; echo '<th>title 4</th>'; echo '<th>title 5</th>'; echo '</tr>'; while($row = mysql_fetch_array($result)){ echo "<tr><td>" . $row['roomcode'] . "</td>"; echo "<td>" . $row['style'] . "</td><td>" . $row['dataprojector'] . "</td>"; echo "<td>" . $row['whiteboard'] . "</td><td>" . $row['ohp'] . "</td>"; echo "<td>" . $row['wheelchairaccess'] . "</td>"; ...
Comments
Post a Comment