note 128143 added to class.pdostatement
| From: | theking2 at king dot ma | Date: | Mon, 23 Jan 2023 17:47:12 +0000 |
| Subject: | note 128143 added to class.pdostatement | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220099@lists.php.net to get a copy of this message | ||
A concise way of getting the data of a single table displayed as HTML table with headers.
<?php
echo '<table>';
$query = "SELECT * FROM
table";
$rows = $db->query($query);
echo '<tr>';
foreach (range(0, $rows->columnCount() - 1) as $column)
echo '<th>'.$rows-> getColumnMeta($column)['name'];
foreach ($rows as $row) {
echo '<tr>';
foreach ($row as $field_name=>$column) {
echo "<td>$column";
}
}
echo '</table>';
?>
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.158.213 (proxied: 185.107.56.231)
----
Manual Page -- https://php.net/manual/en/class.pdostatement.php
Edit -- https://main.php.net/note/edit/128143
Del: integrated -- https://main.php.net/note/delete/128143/integrated
Del: useless -- https://main.php.net/note/delete/128143/useless
Del: bad code -- https://main.php.net/note/delete/128143/bad+code
Del: spam -- https://main.php.net/note/delete/128143/spam
Del: non-english -- https://main.php.net/note/delete/128143/non-english
Del: in docs -- https://main.php.net/note/delete/128143/in+docs
Del: other reasons-- https://main.php.net/note/delete/128143
Reject -- https://main.php.net/note/reject/128143
Search -- https://main.php.net/manage/user-notes.php