I have a very simple program.

Here is the controller.
<?php
class TestsController extends AppController {
 var $name = 'Tests';

 function pass() {
    for ($i = 1; $i <= 3; $i++) {
      $this->set('message',"i is " . $i . "<br>");
    }
 }
}
?>

And here is the view.

<?php
echo $message;
?>

I expected an output like:
i is 1
i is 2
i is 3

but the actual output was:
i is 3.

Does this mean we can't $this->set in a loop? Or am I making a mistake?
I just wanted to get the same result the following code will give,
using cakePHP.

 function pass() {
    for ($i = 1; $i <= 3; $i++) {
      echo "i is " . $i . "<br>";
    }
 }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
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