This usually happens if you have ANY character printed out before the
view actually renders. It can be a single space after the closing php
tag of a php file (controller, model, ...). Therefore you should not
use ?> at the end of php files (CakePHP took the same path in summer
2010). It prevents this from happening.


On 8 Okt., 19:23, Ashwani Kumar <[email protected]> wrote:
> Hi all
>    I'm trying to save some data using add() method in cakephp. This is
> add () method :
>
> function add() {
>                         if (!empty($this->data)){
>                                 if ($this->Book->save($this->data)) {
>                                         $this->Session->setFlash('Data has 
> been saved Successfully!',
> true);
>                                         $this->redirect(array('action' => 
> 'index'));
>                                 }
>                         }
>                 }
> Data is getting saved, but i'm getting following error 
> onhttp://localhost/data-access/books/addpage.
>
> Warning (2): Cannot modify header information - headers already sent
> by (output started at C:\webs\test\data-access\models\book.php:8) [CORE
> \cake\libs\controller\controller.php, line 644]
>
> 3 queries took 8 ms Nr  Query   Error   Affected        Num. rows       Took 
> (ms)
> 1       DESCRIBE `books`                5       5       7
> 2       INSERT INTO `books` (`isbn`, `title`, `description`, `author_name`)
> VALUES ('123', 'test book', 'hi! this is a test.', 'author xyz')              
>   1               1
> 3       SELECT LAST_INSERT_ID() AS insertID             1       1       0
>
> I'm not a cakephp expert, rather i'm learning cakephp. Any reply will
> be appreciated. Thanks in advanced.
>
> Ashwani
> [email protected]

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 [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