Calculation plugin element issue

waby

Member
Hi,

I've tried to calculate elements as below :

$value = JRequest::getVar('comm_fb_swap_transactions_43_repeat___receiver_gourmandise_packaging');
$db =&JFactory::getDBO();
$db->setQuery("SELECT `quantity` FROM `comm_fb_gourmandises_stocks` where `id` = $value");
$totalq = $db->loadResult();
$result = $totalq * {comm_fb_swap_transactions_43_repeat___receiver_reqnumber};
return printf ("%01.2f", $result);

but the result is not displayed and recorded correctly (see attachment).

Any help please ?

Thanks

Eloise
 

Attachments

  • calculation result.jpg
    calculation result.jpg
    8.1 KB · Views: 112
Perhaps $value needs to be quoted in the query?

Code:
$db->setQuery("SELECT `quantity` FROM `comm_fb_gourmandises_stocks` where `id` = " . $db->Quote($value));

if not

try adding

Code:
echo $db->getQuery();
exit;
just after to see what query you are actually generating, perhaps that will give you a clue as to the problem

-Rob
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top