Re: Please Help : I Can't get data of both associated models that are being $hasMany and $belongsTo model

2010-10-13 Thread Ashwani Kumar
Thanx jeremy, so much, for all the help you did for me. Sorry, I didn't
tried Containable, that you asked me to do earlier, because i've just
started learning cakephp and i want to walk step by step.
I got the error. It was my mistake that i named my model filename books.php
and authors.php. Cakephp was not able to find models and that's why the
association couldn't be made.
I'm already a big fan of yours and i'll if i've any question or query. I
also visited your website classoutfit.com, that's such a cool site you've
made. Thanx again for all your help.

On Tue, Oct 12, 2010 at 11:50 PM, Jeremy Burns | Class Outfit 
jeremybu...@classoutfit.com wrote:

 Remove $this-Book-recursive = 1;  That line is effectively stopping any
 searches pat the Book model.

 Did you follow my other tip about Containable?

 A tip; instead of doing pre pre etc... just do debug($authors);

 Jeremy Burns
 *Class Outfit*
 *
 *
 jeremybu...@classoutfit.com jeremybu...@mac.com
 (t) +44 (0) 208 123 3822
 (m) +44 (0) 7973 481949
 Skype: jeremy_burns
 http://www.classoutfit.com

 On 12 Oct 2010, at 18:28, Ashwani Kumar wrote:

 Hi Jeremy! I added
 $authors = $this-Book-Author-find('list');
  in books_controller and now books_controller looks like this :

 ?php
 class BooksController extends AppController {
 var $name = 'Books';

 function index() {
 $this-Book-recursive = 1;
 $books = $this-Book-find('all');
 $this-set('books', $books);
 $authors = $this-Book-Author-find('list');
 $this-set('authors', $authors);
 }
 }

 then i move on to views/books/index.ctp and wrote ?php print 'pre';
 print_r($authors);exit; ? It gave me following error :

 *Notice* (8): Undefined property: AppModel::$Author 
 [*APP\controllers\books_controller.php*, line *9*]

 Code | Context

 $books=   array(
   array(
   Book = array()
 ),
   array(
   Book = array()
 )
 )

 $books = $this-Book-find('all');$this-set('books', 
 $books);$author = $this-Book-Author-find('list');

 BooksController::index() - APP\controllers\books_controller.php, line 9
 Object::dispatchMethod() - CORE\cake\libs\object.php, line 116
 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227
 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194
 [main] - APP\webroot\index.php, line 88


 *Fatal error*: Call to a member function find() on a non-object in *
 C:\webs\test\relationship\app\controllers\books_controller.php* on line *9

 I think models couldn't get associated here. What do u think???



 *

 On Tue, Oct 12, 2010 at 10:40 PM, Jeremy Burns | Class Outfit 
 jeremybu...@classoutfit.com wrote:

 In your add function in the books_controller, you need to populate the
 $authors variable:

 $authors = $this-Book-Author-find('list');

 Then make sure the variable is passed into the view:

 $this-set(compact('authors'));

 or

 $this-set('authors, $authors);

 (they both do the same thing - use the first version if you have more than
 one variable to set and pass)

 Then if you are using the Form helper to build your form, you should have
 this:

 echo $this-Form-input('author_id');

 When Cake draws the author_id input, it will check to see if there is a
 variable that matches (author_id = $authors, book_id = $books, anything_id
 = $anythings - you can follow the pattern). If it finds one (in your case
 $authors) it will assume you want author_id to be a select list, so will use
 the $authors variable as the options.

 You can embellish the input further by adding other options, e.g.:

 echo $this-Form-input(
 'author_id',
  array(
 'empty' = true
 )
 );

 The empty option means that no value is already selected in the list; by
 default the first option value (your first author) is pre-populated. You can
 also do:

 'empty' = 'Please choose an author'


 Jeremy Burns
 *Class Outfit*
 *
 *
 jeremybu...@classoutfit.com jeremybu...@mac.com
 http://www.classoutfit.com

 On 12 Oct 2010, at 17:59, Ashwani Kumar wrote:

 Hi jeremy! Thanx for the reply. I deleted all files from cakephp except
 authors_controller and books_controller and then i added var $scaffold in
 both the files and also deleted all functions from both files. Then i added
 some authors. Now at the time of adding books, Author field should be a Drop
 down menu. But its not happening in my case. Author field is just a Text
 field here in my case. If you could explain why this is happening? is this
 an issue with my cakephp version of what?? By the way i'm using CakePHP 1.3

 On Tue, Oct 12, 2010 at 8:13 PM, Jeremy Burns | Class Outfit 
 jeremybu...@classoutfit.com wrote:

 I wish I had a dollar for every time I have given this response!

 I would use the Containable behaviour, which will give you really fine
 control over what data you get back. It effectively replaces 'recursive'.
 The problem with recursive is that it gives you all data within n steps

Please Help : I Can't get data of both associated models that are being $hasMany and $belongsTo model

2010-10-12 Thread Ashwani Kumar
Hi again!

I'm getting some issue in getting associated array. as you know that when we
fetch some data from a model that's associated with another model via
$hasMany or $belongsTo, we also get data of that associated mode. But i'm
not getting data of that associated model.  I've two tables :
authors
   - id
   - name
   - email
   - website

books
   - id
   - isbn
   - title
   - description
   - author_id

When i fetch fetch authors data i dont' get data of books in result array.

controllers/authors_controller.php

?php
   class AuthorsController extends AppController {
   var $name = 'Authors';

   function index() {
   $this-Author-recursive = 1;
   $authors = $this-Author-find('all');
   $this-set('authors', $authors);
   }
   }

controllers/books_controllers.php

?php
   class BooksController extends AppController {
   var $name = 'Books';

   function index() {
   $this-Book-recursive = 1;
   $books = $this-Book-find('all');
   $this-set('books', $books);
   }
   }

models/authors.php

?php
   class Author extends AppModel {
   var $name = 'Author';
   var $hasMany = array('Book');
   }

models/books.php

?php
   class Book extends AppModel {
   var $name = 'Book';
   var $belongsTo = array('Author');
   }

books
id  isbntitle   description author_id
1   12345   book1   asdfasdfasdf1
2   book2   asdfasfasdf ag as sadfas dfsdaf 1
3   345345  dfgvsdf gsdgsdf sdfg sdfg dfg   2

authors

id  nameemail
website
1   Sams Publications...@samspublications.com
http://www.samspublications.com
2   Test Author auth...@testauthors.com
http://www.author1.com




When i try to run print 'pre'; print_r($authors), i get following
array :

Array
(
   [0] = Array
   (
   [Author] = Array
   (
   [id] = 1
   [name] = Sams Publication
   [email] = s...@samspublications.com
   [website] = http://www.samspublications.com
   )

   )

   [1] = Array
   (
   [Author] = Array
   (
   [id] = 2
   [name] = Test Author
   [email] = auth...@testauthors.com
   [website] = http://www.author1.com
   )

   )

)

So, my problem is that there's no Book array in above array. Please
help... Thanks in advance.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Please Help : I Can't get data of both associated models that are being $hasMany and $belongsTo model

2010-10-12 Thread Ashwani Kumar
Hi jeremy! Thanx for the reply. I deleted all files from cakephp except
authors_controller and books_controller and then i added var $scaffold in
both the files and also deleted all functions from both files. Then i added
some authors. Now at the time of adding books, Author field should be a Drop
down menu. But its not happening in my case. Author field is just a Text
field here in my case. If you could explain why this is happening? is this
an issue with my cakephp version of what?? By the way i'm using CakePHP 1.3

On Tue, Oct 12, 2010 at 8:13 PM, Jeremy Burns | Class Outfit 
jeremybu...@classoutfit.com wrote:

 I wish I had a dollar for every time I have given this response!

 I would use the Containable behaviour, which will give you really fine
 control over what data you get back. It effectively replaces 'recursive'.
 The problem with recursive is that it gives you all data within n steps of
 the current model, rather like rings on an onion. That can be too much data
 and doesn't offer much control.

 In your app_model:

 var $actsAs = array('Containable');
 var $recursive = -1;

 Now every model find will only bring back 'this' model, unless you
 specifically ask it to bring back more. Alternatively, you can place that
 code into selected models if you want to restrict its use, but once you get
 to grips with it you'll use it everywhere.

 Now your find becomes:

 $authors = $this-Author-find(
 'all',
 array(
 'contain' = array('Book')
 )
 );

 Then use the $authors variable as you already are. You should find that it
 now includes array keys for books belonging to each author.

 If you want to bring back just one author:

 $author = $this-Author-find(
 'first',
 array(
 'contain' = array('Book'),
 'conditions' = array('Author.id' = $id)
 )
 );

 (where $id is the id of the author you are searching for)

 If books had publishers, you can bring their information back too:

 $authors = $this-Author-find(
 'all',
 array(
 'contain' = array(
 'Book' = array(
 'Publisher'
 )
 )
 )
 );

 You can see that by adding elements within the contain key you are
 extending your reach and getting back more data, but in a very controlled
 way.

 I hope that helps.

 Jeremy Burns
 *Class Outfit*
 *
 *
 jeremybu...@classoutfit.com jeremybu...@mac.com
 http://www.classoutfit.com

 On 12 Oct 2010, at 15:31, Ashwani Kumar wrote:

 Hi again!

 I'm getting some issue in getting associated array. as you know that when
 we fetch some data from a model that's associated with another model via
 $hasMany or $belongsTo, we also get data of that associated mode. But i'm
 not getting data of that associated model.  I've two tables :
 authors
- id
- name
- email
- website

 books
- id
- isbn
- title
- description
- author_id

 When i fetch fetch authors data i dont' get data of books in result array.

 controllers/authors_controller.php

 ?php
class AuthorsController extends AppController {
var $name = 'Authors';

function index() {
$this-Author-recursive = 1;
$authors = $this-Author-find('all');
$this-set('authors', $authors);
}
}

 controllers/books_controllers.php

 ?php
class BooksController extends AppController {
var $name = 'Books';

function index() {
$this-Book-recursive = 1;
$books = $this-Book-find('all');
$this-set('books', $books);
}
}

 models/authors.php

 ?php
class Author extends AppModel {
var $name = 'Author';
var $hasMany = array('Book');
}

 models/books.php

 ?php
class Book extends AppModel {
var $name = 'Book';
var $belongsTo = array('Author');
}

 books
 id  isbntitle   description author_id
 1   12345   book1   asdfasdfasdf1
 2   book2   asdfasfasdf ag as sadfas dfsdaf 1
 3   345345  dfgvsdf gsdgsdf sdfg sdfg dfg   2

 authors

 id  nameemail
 website
 1   Sams Publications...@samspublications.com
 http://www.samspublications.com
 2   Test Author auth...@testauthors.com
 http://www.author1.com




 When i try to run print 'pre'; print_r($authors), i get following
 array :

 Array
 (
[0] = Array
(
[Author] = Array
(
[id] = 1
[name] = Sams Publication
[email] = s...@samspublications.com
[website] = http://www.samspublications.com
)

)

[1] = Array
(
[Author] = Array
(
[id] = 2
[name] = Test Author

Re: Please Help : I Can't get data of both associated models that are being $hasMany and $belongsTo model

2010-10-12 Thread Ashwani Kumar
Hi Jeremy! I added
$authors = $this-Book-Author-find('list');
 in books_controller and now books_controller looks like this :

?php
class BooksController extends AppController {
var $name = 'Books';

function index() {
$this-Book-recursive = 1;
$books = $this-Book-find('all');
$this-set('books', $books);
$authors = $this-Book-Author-find('list');
$this-set('authors', $authors);
}
}

then i move on to views/books/index.ctp and wrote ?php print 'pre';
print_r($authors);exit; ? It gave me following error :

*Notice* (8): Undefined property: AppModel::$Author
[*APP\controllers\books_controller.php*, line *9*]

Code | Context

$books  =   array(
array(
Book = array()
),
array(
Book = array()
)
)

$books = $this-Book-find('all');
$this-set('books', $books);$author =
$this-Book-Author-find('list');

BooksController::index() - APP\controllers\books_controller.php, line 9
Object::dispatchMethod() - CORE\cake\libs\object.php, line 116
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194
[main] - APP\webroot\index.php, line 88


*Fatal error*: Call to a member function find() on a non-object in *
C:\webs\test\relationship\app\controllers\books_controller.php* on line *9

I think models couldn't get associated here. What do u think???



*

On Tue, Oct 12, 2010 at 10:40 PM, Jeremy Burns | Class Outfit 
jeremybu...@classoutfit.com wrote:

 In your add function in the books_controller, you need to populate the
 $authors variable:

 $authors = $this-Book-Author-find('list');

 Then make sure the variable is passed into the view:

 $this-set(compact('authors'));

 or

 $this-set('authors, $authors);

 (they both do the same thing - use the first version if you have more than
 one variable to set and pass)

 Then if you are using the Form helper to build your form, you should have
 this:

 echo $this-Form-input('author_id');

 When Cake draws the author_id input, it will check to see if there is a
 variable that matches (author_id = $authors, book_id = $books, anything_id
 = $anythings - you can follow the pattern). If it finds one (in your case
 $authors) it will assume you want author_id to be a select list, so will use
 the $authors variable as the options.

 You can embellish the input further by adding other options, e.g.:

 echo $this-Form-input(
 'author_id',
 array(
 'empty' = true
 )
 );

 The empty option means that no value is already selected in the list; by
 default the first option value (your first author) is pre-populated. You can
 also do:

 'empty' = 'Please choose an author'


 Jeremy Burns
 *Class Outfit*
 *
 *
 jeremybu...@classoutfit.com jeremybu...@mac.com
 http://www.classoutfit.com

 On 12 Oct 2010, at 17:59, Ashwani Kumar wrote:

 Hi jeremy! Thanx for the reply. I deleted all files from cakephp except
 authors_controller and books_controller and then i added var $scaffold in
 both the files and also deleted all functions from both files. Then i added
 some authors. Now at the time of adding books, Author field should be a Drop
 down menu. But its not happening in my case. Author field is just a Text
 field here in my case. If you could explain why this is happening? is this
 an issue with my cakephp version of what?? By the way i'm using CakePHP 1.3

 On Tue, Oct 12, 2010 at 8:13 PM, Jeremy Burns | Class Outfit 
 jeremybu...@classoutfit.com wrote:

 I wish I had a dollar for every time I have given this response!

 I would use the Containable behaviour, which will give you really fine
 control over what data you get back. It effectively replaces 'recursive'.
 The problem with recursive is that it gives you all data within n steps of
 the current model, rather like rings on an onion. That can be too much data
 and doesn't offer much control.

 In your app_model:

 var $actsAs = array('Containable');
 var $recursive = -1;

 Now every model find will only bring back 'this' model, unless you
 specifically ask it to bring back more. Alternatively, you can place that
 code into selected models if you want to restrict its use, but once you get
 to grips with it you'll use it everywhere.

 Now your find becomes:

 $authors = $this-Author-find(
 'all',
 array(
  'contain' = array('Book')
 )
 );

 Then use the $authors variable as you already are. You should find that it
 now includes array keys for books belonging to each author.

 If you want to bring back just one author:

 $author = $this-Author-find(
 'first',
 array(
  'contain' = array('Book'),
 'conditions' = array('Author.id' = $id)
  )
 );

 (where $id is the id of the author you are searching for)

 If books had publishers, you can bring their information back too:

 $authors = $this-Author-find(
 'all',
 array(
 'contain' = array(
  'Book' = array(
 'Publisher'
 )
  )
 )
 );

 You can see that by adding elements within the contain

Model association problem - not getting expected array using $hasMany and $belongsTo association

2010-10-11 Thread Ashwani Kumar
Hi all! Today was trying to learn associations but i couldn't succeed.
I'm getting some issue in getting associated array. I've two tables :
authors
- id
- name
- email
- website

books
- id
- isbn
- title
- description
- author_id

controllers/authors_controller.php

?php
class AuthorsController extends AppController {
var $name = 'Authors';

function index() {
$this-Author-recursive = 1;
$authors = $this-Author-find('all');
$this-set('authors', $authors);
}
}

controllers/books_controllers.php

?php
class BooksController extends AppController {
var $name = 'Books';

function index() {
$this-Book-recursive = 1;
$books = $this-Book-find('all');
$this-set('books', $books);
}
}

models/authors.php

?php
class Author extends AppModel {
var $name = 'Author';
var $hasMany = array('Book');
}

models/books.php

?php
class Book extends AppModel {
var $name = 'Book';
var $belongsTo = array('Author');
}

books
id  isbntitle   description author_id
1   12345   book1   asdfasdfasdf1
2   book2   asdfasfasdf ag as sadfas dfsdaf 1
3   345345  dfgvsdf gsdgsdf sdfg sdfg dfg   2

authors

id  nameemail   
website
1   Sams Publications...@samspublications.com   
http://www.samspublications.com
2   Test Author auth...@testauthors.com  
http://www.author1.com




When i try to run print 'pre'; print_r($authors), i get following
array :

Array
(
[0] = Array
(
[Author] = Array
(
[id] = 1
[name] = Sams Publication
[email] = s...@samspublications.com
[website] = http://www.samspublications.com
)

)

[1] = Array
(
[Author] = Array
(
[id] = 2
[name] = Test Author
[email] = auth...@testauthors.com
[website] = http://www.author1.com
)

)

)

So, my problem is that there's no Book array in above array. Please
help... Thanks in advance.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Header already sent error after saving data.

2010-10-09 Thread Ashwani Kumar
all right thanks. I got a new thing to learn in cakephp,  from you.
Thanks a lot once again.

On 10/9/10, euromark dereurom...@googlemail.com wrote:
 not in the view (if it contains HTML)
 but that doesnt matter because at this point the spaces are ok!


 On 9 Okt., 06:40, Ashwani Kumar ashwani.mail...@gmail.com wrote:
 Thanks a lot for your help.

 You're absolutely right 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, ...).

 Actually, I had a lot of space in my model file after closing php tags ?.
 So i removed closing php tag from my model file and it worked just fine.

 So, I've just one think to ask to you that should i skip closing php tag
 in
 my every controller and model file. and can i also skip in view file 

 Thank you once again...

 On Fri, Oct 8, 2010 at 11:25 PM, euromark
 dereurom...@googlemail.comwrote:



  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 ashwani.mail...@gmail.com 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
   ashwani.mail...@gmail.com

  Check out the new CakePHP Questions sitehttp://cakeqs.organd 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+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.c
  omFor more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en

 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+unsubscr...@googlegroups.com For more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Header already sent error after saving data.

2010-10-08 Thread Ashwani Kumar
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 on
http://localhost/data-access/books/add page.

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   AffectedNum. 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
ashwani.mail...@gmail.com

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Header already sent error after saving data.

2010-10-08 Thread Ashwani Kumar
Thanks a lot for your help.

You're absolutely right 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, ...).

Actually, I had a lot of space in my model file after closing php tags ?.
So i removed closing php tag from my model file and it worked just fine.

So, I've just one think to ask to you that should i skip closing php tag in
my every controller and model file. and can i also skip in view file 

Thank you once again...

On Fri, Oct 8, 2010 at 11:25 PM, euromark dereurom...@googlemail.comwrote:

 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 ashwani.mail...@gmail.com 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   AffectedNum. 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
  ashwani.mail...@gmail.com

 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+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Newbie

2010-10-03 Thread Ashwani Kumar
Thanx a lot for the reply. I'll definitely follow, what you've said.

On Sat, Oct 2, 2010 at 11:47 AM, Jeremy Burns | Class Outfit 
jeremybu...@classoutfit.com wrote:

 Bake will get you up and running really quickly but won't teach you
 anything until you lift the lid and start playing. That's probably a good
 way to learn though.

 If I were you I'd create a really simple database and Bake a site from it,
 break it, experiment with it and generally poke around. Then I'd go through
 the two tutorials at the end of the online book. The blog tutorial covers
 the basic MVC patterns in Cake really well. Then I'd just pile into a real
 life app; in my view, nothing beats getting stuck in and solving real
 challenges.


 Jeremy Burns
 *Class Outfit*
 *
 *
 jeremybu...@classoutfit.com jeremybu...@mac.com
 http://www.classoutfit.com

 On 2 Oct 2010, at 06:18, Ashwani Kumar wrote:

 Thanx for quick response. Now i'm in a two minded situation whether
 should I learn to develop applications with cake console (command
 promt) or creating file individually ??? Thanx

 On Oct 1, 5:46 pm, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:

 http://book.cakephp.org/


 Jeremy Burns

 Class Outfit


 jeremybu...@classoutfit.comhttp://www.classoutfit.com


 On 1 Oct 2010, at 11:19, Ashwani Kumar wrote:


 Hi all,

 I'm an intermediate level PHP developer, and i'm gonna learn

 CakePHP. but i don't know how to start with it. However i know a bit

 about MVC pattern, though i don't know about the convention and syntax

 of Cakephp. I've had a videotutorial of cakephp, in which i learn, how

 to bake a cakephp. So in brief, i want to know , how can i learn

 syntaxes used in cakephp. Thanx in advance.


 Check out the new CakePHP Questions sitehttp://cakeqs.organd 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+unsubscr...@googlegroups.com For more options, visit this group
 athttp://groups.google.com/group/cake-php?hl=en


 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+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php?hl=en


  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+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Newbie

2010-10-01 Thread Ashwani Kumar
Hi all,
 I'm an intermediate level PHP developer, and i'm gonna learn
CakePHP. but i don't know how to start with it. However i know a bit
about MVC pattern, though i don't know about the convention and syntax
of Cakephp. I've had a videotutorial of cakephp, in which i learn, how
to bake a cakephp. So in brief, i want to know , how can i learn
syntaxes used in cakephp. Thanx in advance.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Newbie

2010-10-01 Thread Ashwani Kumar
Thanx for quick response. Now i'm in a two minded situation whether
should I learn to develop applications with cake console (command
promt) or creating file individually ??? Thanx

On Oct 1, 5:46 pm, Jeremy Burns | Class Outfit
jeremybu...@classoutfit.com wrote:
 http://book.cakephp.org/

 Jeremy Burns
 Class Outfit

 jeremybu...@classoutfit.comhttp://www.classoutfit.com

 On 1 Oct 2010, at 11:19, Ashwani Kumar wrote:

  Hi all,
          I'm an intermediate level PHP developer, and i'm gonna learn
  CakePHP. but i don't know how to start with it. However i know a bit
  about MVC pattern, though i don't know about the convention and syntax
  of Cakephp. I've had a videotutorial of cakephp, in which i learn, how
  to bake a cakephp. So in brief, i want to know , how can i learn
  syntaxes used in cakephp. Thanx in advance.

  Check out the new CakePHP Questions sitehttp://cakeqs.organd 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+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php?hl=en

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en