note 54302 added to function.mysql-fetch-array

From: Date: Thu, 30 Jun 2005 01:36:34 +0000
Subject: note 54302 added to function.mysql-fetch-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-91168@lists.php.net to get a copy of this message
This is a simple function that outputs a String with a table with the name of fields and their respective values, pretty useful u insert a result like this : $result = mysql_query("select * from table", $db) /*Esta funcion genera automaticamente una tabla que muestra el resultado de un mysql_query, basta con invocar la funcion y con echo imprimirla*/ function muestra_select($result){ $tabla = "\n\t".'<table border="2" align="center" cellpadding="2" cellspacing="2">'."\n"; for($i = 0; $i < mysql_num_fields($result); $i++){ $aux = mysql_field_name($result, $i); $tabla .= "\t\t<th>".$aux."</th>\n"; } while ($linea = mysql_fetch_array($result, MYSQL_ASSOC)) { $tabla .= "\t\t<tr>\n"; foreach ($linea as $valor_col) { $tabla .= "\t\t\t".'<td>'.$valor_col.'</td>'."\n"; } $tabla .= "\t\t</tr>\n"; } $tabla .= "\t</table>\n"; return $tabla; } ---- Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-array.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+54302 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54302&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54302&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54302&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54302&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54302&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54302&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+54302&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#91168) next »