php - PDO query - loop produces duplicate fields? -
the code below producing duplicate <td>
elements each field. trying produce simple html table based on results of pdo query. can tell me why each field being duplicated?
$data = $conn->query('select * students'); // print results in html table echo '<table border="1" cellpadding="5">'; foreach($data $row) { echo '<tr>'; foreach ($row $field) { echo '<td>' . $field . '</td>'; } echo '</tr>'; } echo '</table>';
thanks
it looks using pdo::fetch_both style.
this produce array entries duplicated, once column name keys, , once integer keys.
see following details:
Comments
Post a Comment