jaybeeb Posted April 16, 2008 Share Posted April 16, 2008 I have a table using MYSQL / PHP but I want the headers at the top of the table, so the values below it have some meaning, how do I set it up so the headers are above the table? Here is my code <?php require_once 'library/db.php'; if (!($conn = mysql_connect('localhost', 'root', ''))) { showError(); } if (!(mysql_select_db('itsupport', $conn))) { showError(); } if (!($result = mysql_query('select * from itsupport', $conn))) { showError(); } if(!isset($cmd)) while ($row =mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row[user_ID] . "</td> <td>" . $row[Problem] . " </td> <td>" . $row[Problem_ID] . "</td> <td>" . $row[user_email] . "</td> <td>" . $row[Office_Number] . " </td> <td>" . $row[Phone_Number] . " </td> <td>" . $row[user_Name] . " </td>"; echo "<td><a href=\"selectedit.php?id=$row[user_ID]\"><img border=\"0\" src=\"images/edit.gif\"></a>"; echo "<td><a href=\"delete.php?id=$row[user_ID]\"><img border=\"0\" src=\"images/delete.gif\"></a>"; echo "</tr>"; } mysql_close($conn); ?> Link to comment https://forums.phpfreaks.com/topic/101435-solved-mysql-table-headers/ Share on other sites More sharing options...
jonsjava Posted April 16, 2008 Share Posted April 16, 2008 Not exactly what you were expecting, but why add overhead if you don't gotta? <?php require_once 'library/db.php'; if (!($conn = mysql_connect('localhost', 'root', ''))) { showError(); } if (!(mysql_select_db('itsupport', $conn))) { showError(); } if (!($result = mysql_query('select * from itsupport', $conn))) { showError(); } if(!isset($cmd)) print "<tr> <td>User_ID</td> <td>Problem</td> <td>Problem_ID</td> <td>User_email</td> <td>Office_Number</td> <td>Phone_Number</td> <td>User_Name</td> <td> </td> <td> </td> <tr>"; while ($row =mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row[user_ID] . "</td> <td>" . $row[Problem] . " </td> <td>" . $row[Problem_ID] . "</td> <td>" . $row[user_email] . "</td> <td>" . $row[Office_Number] . " </td> <td>" . $row[Phone_Number] . " </td> <td>" . $row[user_Name] . " </td>"; echo "<td><a href=\"selectedit.php?id=$row[user_ID]\"><img border=\"0\" src=\"images/edit.gif\"></a>"; echo "<td><a href=\"delete.php?id=$row[user_ID]\"><img border=\"0\" src=\"images/delete.gif\"></a>"; echo "</tr>"; } mysql_close($conn); Link to comment https://forums.phpfreaks.com/topic/101435-solved-mysql-table-headers/#findComment-518868 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.