Jump to content

[RESOLU] Question Bête...


daftfunk
 Share

Recommended Posts

Je cherche a faire la somme des montants de toutes les commandes d'un client donné...

 

 

et j'essaye des trucs mais j'arrive pas a sortir ni le code PHP ni le Tpl, mon niveau en POO étant assez limité - si une âme charitable pouvait ma donner et m'expliquez comment ça marche sur ce cas précis

 

 

Par avance merci de votre sollicitude

Edited by daftfunk (see edit history)

Share this post


Link to post
Share on other sites

Genre

 

$total = Db::getInstance()->getRow('
   SELECT [color=#343943][font=Arial, Helvetica, sans-serif][size=3]SUM([/size][/font][/color]`total_paid`)
   FROM `'._DB_PREFIX_.'orders`
   WHERE `id_customer` = \''.pSQL($cookie->id_customer).'\'');
					   $smarty->assign('total',$total);

 

Mais ça me renvoi quand je l'appelle ds le tpl "Array" .... question comment je récupère la valeur?

Edited by daftfunk (see edit history)

Share this post


Link to post
Share on other sites

Je suis embêté avec ce code Il y rien qui sort :(

 

 

 

$total = Db::getInstance()->getValue('
SELECT SUM(`total_paid`)
FROM `'._DB_PREFIX_.'orders`
WHERE `id_customer` = \''.pSQL($cookie->id_customer).'\'');
$smarty->assign('total',$total);

Share this post


Link to post
Share on other sites

Toujours rien

 

Tu l'ouvres quand la parenthese :)

 

 

WHERE `id_customer` = \''.(int)$cookie->id_customer)'\'');

 

WHERE `id_customer` = \''.(int)($cookie->id_customer)'\'');?

 

j'ai fait moulte combinaisons toujours pas de sortie :(

Share this post


Link to post
Share on other sites

Plus de succès avec

 

$total = Db::getInstance()->getValue('
SELECT SUM(`total_paid`) 
FROM `'._DB_PREFIX_.'orders`
WHERE `id_customer` = \''.pSQL($cookie->id_customer).'\'');

$smarty->assign('total',$total);

 

Merci de votre aide

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More