Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Somme sur colonne d'une table 23 Mar 2012 04:40 #1713

  • Johnny
  • Johnny's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 5
  • Thank you received: 0
Bonjour , et bravo pour votre projets Jcook.

J'ai créer un composant et je suis sur le point de le finaliser, mais je bute sur un élement :

dans ma table j'ai une colonne qui comporte des montants et souhaiterait savoir comment faire pour créer le total de cette colonne. ( fonction sum)

Dans l'attente de vous lire
Johnny

Please Log in or Create an account to join the conversation.

Re: Somme sur colonne d'une table 23 Jul 2012 09:44 #2842

  • LJ01
  • LJ01's Avatar
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 78
  • Thank you received: 2
dans le model d'une vue collection tu peux utiliser
       	function plouplouf()
	  {    	                                    
	  $user = JFactory::getUser();
	  $userid = $user->id;

	  $params = JComponentHelper::getParams('com_component');
	  $plouf= $params->get('plouf', 1);
		                       
		$database =& JFactory::getDBO()  ;
	 	$database->setQuery( "SELECT SUM(ma-colonne)
					FROM #__batenergie WHERE author='$userid'
					" );
		  if (!$database->query()) {
		    echo $database->stderr();
		    return false;
		  }
	  return $database->loadResult();
	  }
que tu transmets a ton tmpl par le view.html
LJ
Ce sont les fils qui font les cordes
ingall-niger.org
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.076 seconds

  I found "cook" two days ago. Played around with it for a day and then within a day got rid of two legacy applications in IBM Lotus Domino Notes and replaced them with "cook". It was really easy. A piece of cake. Actually it was even easier than cooking. Cooking involves more work than developing with "cook". What can I say about "cook"? Great application great price for what it delivers great forum with a lot of information and fast responses active and friendly community fast forward moving development cycle So what should I say "Monsieur Le Cook"? Keep the good work going it will lead to success. Having become a paying member in the words of Edith Piaf may I say ..... non rien de rien ... je ne regrette rien. Vive La France.
FK (JED)
         

Get Started