FORUM Tom's Hardware » Programmation » PHP & MySQL & ASP » [PHP] Faire une moyenne
 

[PHP] Faire une moyenne

Il y a 329 utilisateurs connus et inconnus. Pour voir la liste des connectés connus, cliquez ici
Ajouter une réponse



 Mot :   Pseudo :  
 
Bas de page
Auteur
 Sujet : [PHP] Faire une moyenne
 
Plus d'informations

:hello:

j'ai une j'ai une bdd mysql avec une belle base, et dans celle ci une table
je voudrais recuperer des chiffres dans cette table et en faire une moyenne

comment faire ?

merci :o


---------------
BDD Asrock -- > Hébergez vos images < --A vendre

Profil : Pointeur
Plus d'informations

select avg(column) from table


---------------
Da Bidz Triad©®™: Bidz Interceptor
.:: Smileyz version 4.2 [050625]::. -- Code source disponible sous licence GPL.
[u
Plus d'informations

tu remplaces column par quoi ?


---------------
BDD Asrock -- > Hébergez vos images < --A vendre
Profil : Pointeur
Plus d'informations

bha pas la colonne qui contient les chiffres...


---------------
Da Bidz Triad©®™: Bidz Interceptor
.:: Smileyz version 4.2 [050625]::. -- Code source disponible sous licence GPL.
[u
Plus d'informations

je t'explique, j'ai une bdd "netdel", une table "toto" avec dedans un champs "titi" :o


---------------
BDD Asrock -- > Hébergez vos images < --A vendre
pourquoi faire cent fois la même chose ?
Plus d'informations

Cech@IDN a écrit :

je t'explique, j'ai une bdd "netdel", une table "toto" avec dedans un champs "titi" :o



bah la colone c'est titi ...

Plus d'informations

ok, j'avais un doute


---------------
BDD Asrock -- > Hébergez vos images < --A vendre
Plus d'informations

je suis si con que j'arrive pas a faire marcher un echo :o


$test=mysql_query("select avg(titi) from 'toto'" );
echo $test;


Message édité par ginie le 19-06-2005 à 21:00:38

---------------
BDD Asrock -- > Hébergez vos images < --A vendre
Profil : Pointeur
Plus d'informations

euh.... c'est quoi ces 2 et 3 ?


---------------
Da Bidz Triad©®™: Bidz Interceptor
.:: Smileyz version 4.2 [050625]::. -- Code source disponible sous licence GPL.
[u
Plus d'informations

avg(titi) from 'toto' :o


---------------
BDD Asrock -- > Hébergez vos images < --A vendre
Profil : Pointeur
Plus d'informations

bha oui mais avec des noms de colonne comme ca [:mlc]

sinon pour récupérer les résultats, c'est mysql_fetch_row


---------------
Da Bidz Triad©®™: Bidz Interceptor
.:: Smileyz version 4.2 [050625]::. -- Code source disponible sous licence GPL.
[u
Plus d'informations

mysql_fetch_row($test)
echo $test ?


---------------
BDD Asrock -- > Hébergez vos images < --A vendre
Profil : Pointeur
Plus d'informations

---------------
Da Bidz Triad©®™: Bidz Interceptor
.:: Smileyz version 4.2 [050625]::. -- Code source disponible sous licence GPL.
[u
Plus d'informations

$test=mysql_query("select avg(titi) from 'toto'" );
$result = mysql_fetch_row($test);
echo $result;


Warning: mysql_fetch_row(): supplied argument is not a valid MySQL


---------------
BDD Asrock -- > Hébergez vos images < --A vendre
Profil : Pointeur
Plus d'informations

verifie $test...


---------------
Da Bidz Triad©®™: Bidz Interceptor
.:: Smileyz version 4.2 [050625]::. -- Code source disponible sous licence GPL.
[u
Plus d'informations

tu fais ça comment ?


---------------
BDD Asrock -- > Hébergez vos images < --A vendre
Profil : Pointeur
Plus d'informations

comme sur le lien que j'ai donné :o


---------------
Da Bidz Triad©®™: Bidz Interceptor
.:: Smileyz version 4.2 [050625]::. -- Code source disponible sous licence GPL.
[u
Plus d'informations

Impossible d'exécuter la requête : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''toto'' at line 1


---------------
BDD Asrock -- > Hébergez vos images < --A vendre
Profil : Pointeur
Plus d'informations