I want the table header like this: NUME, DECEDATI etc. I tried with echo also and it doesn't work. Please help me!
PHP code:
<?php
print "<table";
print "<tr>";
print "<th>NUME </th>";
print "<th> DECEDATI </th>";
print "<th> RANITI </th>";
print "<th> DISPARUTI </th>";
print "<th> CLADIRI DISTRUSE </th>";
print "<th> DURATA </th>";
print "<th> MAGNITUDINE </th>";
print "<th> ADANCIME </th>";
print "<th> PAGUBE MATERIALE </th>";
print "<th> NUMAR REPLICI </th>";
print "</tr>";
print "</table>";
$conn = oci_connect('student', 'STUDENT', 'localhost/XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
// Prepare the statement
$stid = oci_parse($conn, "SELECT * FROM nepal ORDER BY ".$_GET['categorie']." ".$_GET['ordine']);
if (!$stid) {
$e = oci_error($conn);
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
// Perform the logic of the query
$r = oci_execute($stid);
if (!$r) {
$e = oci_error($stid);
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
// Fetch the results of the query
print "<table border='1'>\n";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
print "<tr>\n";
foreach ($row as $item) {
print " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : " ") . "</td>\n";
}
print "</tr>\n";
}
print "</table>\n";
oci_free_statement($stid);
oci_close($conn);
?>
The display of my code containts the body of the table without the table header.