select count(*) + group by : les sortir en php

select count(*) + group by : les sortir en php - PHP - Programmation

Marsh Posté le 09-06-2006 à 11:19:10    


Bonjour,
je voudrais sortir les resultats de la requete :
 
SELECT count( * ) FROM `site` GROUP BY site_cat ORDER BY site_cat ASC
en php :
<?php
$sql="SELECT count( * ),site_cat FROM `site` GROUP BY site_cat ORDER BY site_cat ASC";
$requete=mysql_query($sql);
$row=mysql_fecth_array($requete);
 
print_r($row); +---> ca ne me donne que le 1er count(*) !!!
 
Une idée ?

Reply

Marsh Posté le 09-06-2006 à 11:19:10   

Reply

Marsh Posté le 09-06-2006 à 11:47:50    

Il faut rappelle mysql_fetch_array pour avancer le curseur de lecture
http://uk2.php.net/manual/en/funct [...] -array.php

Code :
  1. while ($row = msql_fetch_array($requete)) {
  2.    print_r($row)
  3. }


---------------
my flick r - Just Tab it !
Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed