[gull] Questions sur requête SQL intégrée dans php

Philippe Faehndrich ph.faehndrich at bluewin.ch
Thu Apr 13 01:17:44 CEST 2006


Le Mercredi 12 Avril 2006 22:52, Rafael Muñoz Moreno-Davila a écrit :
> Hello,
>
> Voici mon code:
>
> // fetch first row of the result in a hash (otherwise use mysql_fetch_row
> // if you want an array (see below)
> $value = mysql_fetch_array($result) or die(mysql_error());

Dans la documentation de PHP 
(http://php.benscom.com/manual/fr/function.mysql-fetch-array.php),
je lis:
mysql_fetch_array --  Retourne une ligne de résultat MySQL sous la forme d'un 
tableau associatif, d'un tableau indexé, ou les deux

et encore:
Valeurs de retour
Retourne un tableau qui correspond à la ligne récupérée ou FALSE s'il n'y a 
plus de lignes.

Donc, la fonction ne retourne qu'une seule ligne. Si tu veux parcourir 
l'ensemble de ta DB, il faut appeler mysql_fetch_array dans une boucle 
jusqu'à ce qu'elle renvoie "false".

PhF



More information about the gull mailing list