/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function getHtmlTable($rs){ // receive a record set and print // it into an html table $out = '<table>'; while ($field = $rs->fetch_field()) $out .= "<th>".$field->name."</th>"; while ($linea = $rs->fetch_assoc()) { $out .= "<tr>"; foreach ($linea as $valor_col) $out .= '<td>'.$valor_col.'</td>'; $out .= "</tr>"; } $out .= "</table>"; return $out; }
URL: http://www.barattalo.it/2010/01/29/10-php-usefull-functions-for-mysqli-improved-stuff/