Return to Snippet

Revision: 23176
at February 1, 2010 05:47 by ginoplusio


Initial Code
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;
}

Initial URL
http://www.barattalo.it/2010/01/29/10-php-usefull-functions-for-mysqli-improved-stuff/

Initial Description


Initial Title
MySQLi convert a result set to an HTML table

Initial Tags
mysql, table, html

Initial Language
PHP