Ich möchte eine Tabelle erstellen, die die Werte einer MySQL-Tabelle zeigen. Das Problem ist, dass ich beim Öffnen der Seite nur den Spaltennamen habe. Aber ich sehe keine Reihe. Ich möchte auch einen Hyperlink jeder Zeile machen. Wie ich das machen werde.PHP Tabelle Problem
Hier ist mein Code:
<?php
include_once 'rnheader.php';
echo '</br>';
echo '<a href = "rnservices.php"> Create Service</a> ';
echo '<table>';
echo '<tr>';
echo '<th>Service ID</th>';
echo '<th>Title</th>';
echo '<th>Description</th>';
echo '<th>Notes</th>';
echo '<th>Submit By</th>';
echo '<th>Assigned Employee</th>';
echo '<th>Assigned Group</th>';
echo '<th>Category</th>';
echo '<th>Status</th>';
echo '<th>Urgency</th>';
echo '<th>Customer</th>';
echo '<th>Day Created</th>';
echo '</tr>';
$query = ("SELECT ServiceID, Title, Description, Notes, "
." SubmitBy, AssignedEmp, AssignedGroup, "
." NameCategory, TipoStatus, TiposUrgencia, "
." CustomerName, DayCreation "
."FROM Service");
$result = queryMysql($query);
echo 'Number of Rows: ' . mysql_num_rows($result);
while ($row = mysqli_fetch_assoc($result)) {
echo '<tr>';
echo '<td>' . $row['ServiceID'] . '</td>';
echo '<td>' . $row['Title'] . '</td>';
echo '<td>' . $row['Description'] . '</td>';
echo '<td>' . $row['Notes'] . '</td>';
echo '<td>' . $row['SubmitBy'] . '</td>';
echo '<td>' . $row['AssignedEmp'] . '</td>';
echo '<td>' . $row['AssignedGroup'] . '</td>';
echo '<td>' . $row['NameCategory'] . '</td>';
echo '<td>' . $row['TipoStatus'] . '</td>';
echo '<td>' . $row['TiposUrgencia'] . '</td>';
echo '<td>' . $row['CustomerName'] . '</td>';
echo '<td>' . $row['DayCreation'] . '</td>';
echo '</tr>';
}
mysqli_free_result($result);
echo '</table>';
?>
Hat mysql_error() alles zeigen? – Tobias
der mysqli_fetch_assoc war mein Fehler. Aber kann ein Hyperlink für jede Zeile erstellt werden? – maltad
Sie schließen die Tabelle nicht ... Sie sollten zuerst in den generierten HTML-Code schauen. –