• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

calc element sum

leblancphil

Member
Hi
I try to build a calc element with that query
Code:
SELECT SUM(prix_parcours) FROM admin3_parcours , admin3_scol_parcours WHERE admin3_parcours.id = admin3_scol_parcours.parours_id AND admin3_scol_parcours.scol_id = $scol_id
That works in phpMyAdmin, replacing $scol_id by the right value

When I test
Code:
$scol_id = '{admin3_scolarites___id}';
return $scol_id;
Ok, I have my value

I do this in my calc element ( and tried many other ways) but no result.
Code:
$scol_id = '{admin3_scolarites___id}';
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery->select('SUM(prix_parcours)')->from('admin3_parcours', 'admin3_scol_parcours')->where('admin3_parcours.id' = 'admin3_scol_parcours.parours_id' AND 'admin3_scol_parcours.scol_id' = $scol_id);
$myDb->setQuery($myQuery);
$devis = $myDb->loadResult();
return $devis;
Could you help please ?
Thanks
 
Try _id_raw
ah, and inside where() you must have a string

Gesendet von meinem GT-I9300 mit Tapatalk
 
Thanks for your answer, it's not a id_raw pb, I have tested and I dont understand how to organise where() to have a string.
 
->where('admin3_parcours.id' = 'admin3_scol_parcours.parours_id' AND 'admin3_scol_parcours.scol_id' = $scol_id)
Must be something like
->where('admin3_parcours.id = admin3_scol_parcours.parours_id AND admin3_scol_parcours.scol_id = '. $scol_id)

for debugging add
echo $myQuery;exit;
before return
 
Works fine
Thank youuuuuuuuuuuuouuuuuuuuuuuouuuuuuuuuuuuuu
p101_Festival_Cor_des_Alpes1.jpg
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top