note 98504 added to mysqli-result.fetch-field

From: Date: Sat, 19 Jun 2010 02:58:49 +0000
Subject: note 98504 added to mysqli-result.fetch-field
Groups: php.notes 
Request: Send a blank email to php-notes+get-170260@lists.php.net to get a copy of this message
public function table(mysqli_result $result) { echo "<table border='1'><tr>\n"; while($finfo = $result->fetch_field()) { $colnames[] = $finfo->name; } $c = count($colnames); //no function call at every iteration for($i=0; $i<$c; $i++) { echo "<th>" . $colnames[$i] . "</th>"; } echo "</tr>\n"; while($row = $result->fetch_assoc()) { echo '<tr>' ; for($j=0; $j<$c; $j++) { echo "<td>" . $row[$colnames[$j]] . "</td>"; } echo "</tr>\n"; } echo "</table>"; } ---- Server IP: 69.147.83.197 Probable Submitter: 184.34.6.220 ---- Manual Page -- http://www.php.net/manual/en/mysqli-result.fetch-field.php Edit -- https://master.php.net/note/edit/98504 Del: integrated -- https://master.php.net/note/delete/98504/integrated Del: useless -- https://master.php.net/note/delete/98504/useless Del: bad code -- https://master.php.net/note/delete/98504/bad+code Del: spam -- https://master.php.net/note/delete/98504/spam Del: non-english -- https://master.php.net/note/delete/98504/non-english Del: in docs -- https://master.php.net/note/delete/98504/in+docs Del: other reasons-- https://master.php.net/note/delete/98504 Reject -- https://master.php.net/note/reject/98504 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#170260) next »