Tema: Matriz
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 29/09/2008, 10:44
Avatar de Synkronice
Synkronice
 
Fecha de Ingreso: octubre-2007
Ubicación: Madrid
Mensajes: 831
Antigüedad: 16 años, 6 meses
Puntos: 48
Respuesta: Matriz

La funcion mysql_fetch_array() ya lo hace por tí. Mira este ejemplo sacado del manual oficial de PHP.

Código PHP:
mysql_connect("localhost""mysql_user""mysql_password") or
    die(
"Could not connect: " mysql_error());
mysql_select_db("mydb");

$result mysql_query("SELECT id, name FROM mytable");

while (
$row mysql_fetch_array($resultMYSQL_ASSOC)) {
    
printf("ID: %s  Name: %s"$row["id"], $row["name"]);
}

mysql_free_result($result); 
Referencias:

http://es.php.net/manual/es/function...etch-array.php