DS928
asked on
Losing My Head(ers)
I have my table being created, but I don't have my Headers, they seem to be in with the rows. How can I fix This?
The headers are:
Record ID
Customer
Site
User Name
Password
Date Added
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT recordId, recordCust, recordSite, recordUser, recordPass, recordDateAdded FROM records";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
echo '<table>';
while($row = $result->fetch_assoc()) {
echo "<tr class='viewpost'>";
if(!empty($row['recordId'])) {
echo '<td>Record ID: ' . $row['recordId'] . '</td>';
}
else
{
echo '<td>Record ID: NA</td>';
}
if(!empty($row['recordCust'])) {
echo '<td>Customer' . $row['recordCust'] . '</td>';
}
else
{
echo '<td>Customer: NA</td>';
}
if(!empty($row['recordSite'])) {
echo '<td>Site' . $row['recordSite'] . '</td>';
}
else
{
echo '<td>Site: NA</td>';
}
if(!empty($row['recordUser'])) {
echo '<td>User Name' . $row['recordUser'] . '</td>';
}
else
{
echo '<td>User Name: NA</td>';
}
if(!empty($row['recordPass'])) {
echo '<td>Password' . $row['recordPass'] . '</td>';
}
else
{
echo '<td>Password: NA</td>';
}
if(!empty($row['recordDateAdded'])) {
echo '<td>Date Added' . $row['recordDateAdded'] . '</td>';
}
else
{
echo '<td>Date Added: NA</td>';
}
echo "</tr>"; //closing row
}
echo '</table>';
The headers are:
Record ID
Customer
Site
User Name
Password
Date Added
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Forgive my curiosity, but I see from your history here at EE that you're questioning about css, javascript and the rest in the last two years. so I would expect you have some knowledge about these stuffs... but your doubt about HTML tables are typical of a total beginner, so I think I'm missing something :-)
ASKER
Yes, I do have some knowledge, but in many ways I am still a beginner. So your help is greatly appreciated!
Good luck with your project, then!
ASKER
Thank you! I think the inclusion of the PHP is throwing me off. :)
I can suggest you this wonderful book which will help you to integrate php, mysql and html:
http://www.sitepoint.com/books/phpmysql5/
http://www.sitepoint.com/books/phpmysql5/
ASKER