Fixed it by simply creating the table following John L's table's
description. After that I got undefined PHP error which I placed what
John L's fix in his last post. I ran cake report> and I got empty
results:
C:\wamp\www\cakephp>cake report
♀
Welcome to CakePHP v1.3.6 Console
---------------------------------------------------------------
App : app
Path: C:\wamp\www\cakephp\app
---------------------------------------------------------------
~~~Above is First attempt with Orders table no records~~~
~~~Below is Second attempt with Orders table 2 records~~~
C:\wamp\www\cakephp>cake report
♀
Welcome to CakePHP v1.3.6 Console
---------------------------------------------------------------
App : app
Path: C:\wamp\www\cakephp\app
---------------------------------------------------------------
Order date: 2010-12-02 12:16:06
Amount: $100.50
----------------------------------------
Total: $100.50(this shouldn't be printed)//Maxim's comment
Order date: 2010-12-09 12:16:38
Amount: $50.30
----------------------------------------
Total: $150.80(correct)//Maxim's comment
~~~
I think my initial problem is solved thanks to both John L and lyles.
When look at the first record, it printed the total as well, which it
shouldn't. That is just php script logical error..not the batch
settings' problem.
When looking at the second record its total is sum of the previous
one.
So we need to insert some records before we do >cake report to see
results in cmd ?(I know this is common sense but I'd like to confirm).
I didn't create any model for this report but it worked ?
Thanks again John L and Lyles. Regards,
Maxim
On Dec 30, 2:26 am, John L <confidentia...@gmail.com> wrote:
> This table works for the tutorial:
>
> CREATE TABLE orders(
> id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
> amount DEC(5,2),
> created DATETIME,
> shipped DATETIME
> );
>
> Then bake the model, controller and views. Go to /orders/add and add some
> orders to the database. Assuming the cake command is in your PATH, cake
> report should now work.
>
> Well with one exception (maybe). I was getting this error: Notice undefined
> variable: total in C:\...\vendors\shells\report.php on line 17
>
> This line is the problem: $total += $order['Order']['amount'];
> PHP won't accept this line if $total is not set
>
> So my simple solution is:
>
> if(!isset($total)){
> $total = $order['Order']['amount'];} else {
>
> $total += $order['Order']['amount'];
>
> }
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment