Calculations element - extra characters added to code

chili_666

New Member
Hi,

I am trying to get a calculations field to work. It is just supposed to summarize a column. The code should look like this:

Code:
$my_db = FabrikWorker::getDbo();
$my_query = $my_db->getQuery(true);
$my_query->select('SUM(ve_pellets) AS my_total')->from('lose_pellets');
$my_db->setQuery($my_query);
return $my_db->loadResult();

What it does look like is:

Code:
$my_query->select(SUM('ve_pellets') AS my_total)->from('lose_pellets');

The extra "\" are bugging me - I can delete them, but as soon as I save the element, they come back...

Any tips or tricks?

Thanks!

Luis
 
P.S. Are you saying that it goes from:
PHP:
$my_query->select('SUM(ve_pellets) AS my_total')->from('lose_pellets');
to
PHP:
$my_query->select(SUM('ve_pellets') AS my_total)->from('lose_pellets');

I can understand if there was a bug which changed ' to \' (this sort of bug is fairly common in web apps), but I cannot understand why it would have moved the ' from before SUM( to after it i.e.
PHP:
'SUM(
to
PHP:
SUM('
.

Can you confirm that this is what is happening?

Thx. S
 
I can't replicate this. I copied and pasted the code from the OP into a calc element, and it saves just fine, with no changes.

What version of PHP is this, and do you have magic quotes enabled?

-- hugh
 
also could you go into your admin and go to
administrator/index.php?option=com_admin&view=sysinfo

under the PHP settings tab check that :

Magic Quotes = Off

If it isn't then you will need to set up PHP to turn those off. your host should have info on how to do that
 
Back
Top