par
scadox » 30 juil. 2008, 15:53
Bonjour a tous,
voici un tableau :
Je voudrais faire un calcul de touts dans la colonnes [prix]
Parske la manière que je functionne je suis sur qu'il a mieux.
$sql_docs_paiements = "SELECT * FROM docs_paiements WHERE client_id=\"$id\" ORDER by id LIMIT 0,1"; $req_docs_paiements = mysql_query($sql_docs_paiements); while($data_docs_paiements = mysql_fetch_assoc($req_docs_paiements)) {$prix0 = $data_docs_paiements['prix'] ;}
$sql_docs_paiements = "SELECT * FROM docs_paiements WHERE client_id=\"$id\" ORDER by id LIMIT 1,1"; $req_docs_paiements = mysql_query($sql_docs_paiements); while($data_docs_paiements = mysql_fetch_assoc($req_docs_paiements)) {$prix1 = $data_docs_paiements['prix'] ;}
$sql_docs_paiements = "SELECT * FROM docs_paiements WHERE client_id=\"$id\" ORDER by id LIMIT 2,1"; $req_docs_paiements = mysql_query($sql_docs_paiements); while($data_docs_paiements = mysql_fetch_assoc($req_docs_paiements)) {$prix2 = $data_docs_paiements['prix'] ;}
$total_paiements_fait_ = $prix0 + $prix1 + $prix2 ;
echo "$total_paiements_fait_";
Je n'ai pas le gout de taper ce code 55 millions de fois
j'atend de vos explications, je vous remercie et passez une belle journées a tous !
Bonjour a tous,
voici un tableau :
[img]http://kustomblog.com/1/aaiiddee.jpg[/img]
Je voudrais faire un calcul de touts dans la colonnes [prix]
Parske la manière que je functionne je suis sur qu'il a mieux.
[php]
$sql_docs_paiements = "SELECT * FROM docs_paiements WHERE client_id=\"$id\" ORDER by id LIMIT 0,1"; $req_docs_paiements = mysql_query($sql_docs_paiements); while($data_docs_paiements = mysql_fetch_assoc($req_docs_paiements)) {$prix0 = $data_docs_paiements['prix'] ;}
$sql_docs_paiements = "SELECT * FROM docs_paiements WHERE client_id=\"$id\" ORDER by id LIMIT 1,1"; $req_docs_paiements = mysql_query($sql_docs_paiements); while($data_docs_paiements = mysql_fetch_assoc($req_docs_paiements)) {$prix1 = $data_docs_paiements['prix'] ;}
$sql_docs_paiements = "SELECT * FROM docs_paiements WHERE client_id=\"$id\" ORDER by id LIMIT 2,1"; $req_docs_paiements = mysql_query($sql_docs_paiements); while($data_docs_paiements = mysql_fetch_assoc($req_docs_paiements)) {$prix2 = $data_docs_paiements['prix'] ;}
$total_paiements_fait_ = $prix0 + $prix1 + $prix2 ;
echo "$total_paiements_fait_";
[/php]
Je n'ai pas le gout de taper ce code 55 millions de fois
j'atend de vos explications, je vous remercie et passez une belle journées a tous !