When I make a query to a table that results in two rows, for example:
$sql= "SELECT id, nombre, apellido FROM usuarios WHERE nombre = 'Juan'";
$res = $db->query($sql) or die("error: ".$sql);
$row = $res->fetch_assoc();
and I get this result;
id: 1 nombre: Juan apellido: Rodriguez
id: 5 nombre: Juan apellido: Herrero
id: 8 nombre: Juan apellido: Fuentes
How can I access all this data from php? because I can only access the first record using $row['id']
$row['nombre']
$row['apellido']