marcq
Member
Hi,
I have created the following Mysql query in order to sum an element :
I've tested the query in PHPMYADMIN :
and the query is returning the good values :
id | prix
4 | 450.00
4 | 2000.00
The problem is the way I get the Id of the Form which is certainly wrong. I tried this :
but doesn't seems to work.
I would appreciate if someone could check my query.
Cheers,
Marc
I have created the following Mysql query in order to sum an element :
Code:
$id= '{thistable}.id';
$db = JFactory::getDbo();
$query= "SELECT gprh_fabrik_user_enrollment.id, gprh_fabrik_user_training_124_repeat.prix
FROM (gprh_fabrik_user_enrollment LEFT JOIN gprh_fabrik_user_enrollment_repeat_choix_formation ON gprh_fabrik_user_enrollment.id = gprh_fabrik_user_enrollment_repeat_choix_formation.parent_id) LEFT JOIN gprh_fabrik_user_training_124_repeat ON gprh_fabrik_user_enrollment_repeat_choix_formation.choix_formation = gprh_fabrik_user_training_124_repeat.id
WHERE (((gprh_fabrik_user_enrollment.id)= " . $db->quote($id)"))";
$db->setQuery($query);
$total = $db->loadResult();
return $total;
I've tested the query in PHPMYADMIN :
Code:
SELECT gprh_fabrik_user_enrollment.id, gprh_fabrik_user_training_124_repeat.prix FROM (gprh_fabrik_user_enrollment LEFT JOIN gprh_fabrik_user_enrollment_repeat_choix_formation ON gprh_fabrik_user_enrollment.id = gprh_fabrik_user_enrollment_repeat_choix_formation.parent_id) LEFT JOIN gprh_fabrik_user_training_124_repeat ON gprh_fabrik_user_enrollment_repeat_choix_formation.choix_formation = gprh_fabrik_user_training_124_repeat.id WHERE (((gprh_fabrik_user_enrollment.id)= 4))
and the query is returning the good values :
id | prix
4 | 450.00
4 | 2000.00
The problem is the way I get the Id of the Form which is certainly wrong. I tried this :
Code:
$id= '{thistable}.id';
but doesn't seems to work.
I would appreciate if someone could check my query.
Cheers,
Marc
Last edited: