This is probably an easy answer but I give up. Why doesn't the number
helper work in my controller when it works fine in my views?

class InvoicesController extends AppController {
        var $name = 'Invoices';
        var $helpers = array('Html', 'Form', 'Javascript', 'Ajax', 'Number');
        ...
        $totaldue = 0;
        foreach ($this->Invoice->findAll('status!=2', NULL, NULL) as $row)
{      // for each invoice thats not paid
                $totaldue += preg_replace("/(\\$|,)/", "", $row['Invoice']
['total']); // turn each invoice total into a float and sum them
        }
        $this->set('totaldue', strrev(preg_replace("/(\d{3})/", "$1,",
strrev($number->precision($totaldue, 2))))); // add commas to total
and set it
        ...
}

If I change $number->precision($totaldue, 2) to just $totaldue there
are no errors by the way.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to