Re: Saber nombre del campo
| From: | Rafael Salazar | Date: | Sun, 09 Nov 2003 22:29:00 +0000 |
| Subject: | Re: Saber nombre del campo | ||
| References: | 1 2 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-42340@lists.php.net to get a copy of this message | ||
At 09/11/2003 07:28, you wrote:
while ($registro = mysql_fetch_row($resultado)){
echo "<tr>";
foreach($registro as $clave){
echo "<td>",$clave,"</td>";
}
}
Podrías usar mysql_fetch_assoc (o mysql_fetch_array para dejarlo "configurable") De esta forma sólo bastaría un pequeña modificación, ya que en lugar deforeach( $registro as $clave ) podrías usar un foreach( $registro as $nombre => $valor ) Más info: - http://www.php.net/manual/en/function.mysql-fetch-assoc.php - http://www.php.net/manual/en/function.mysql-fetch-array.php
Rafael.