make use of

var $uses;

in ur controller

include the required model names in ur controller

perform ur query

using

$this->modelname->query;

use this link to study more of it

http://book.cakephp.org/view/53/components-helpers-and-uses


http://book.cakephp.org/view/456/query




hope this will help... :-)
.................................................................


On Tue, Sep 8, 2009 at 12:23 PM, Martin Westin
<[email protected]>wrote:

>
> You have had your first bump into the wall of strictly linking views,
> controller and model. I generally tend to link the views and
> controller more and keep my models more loose. That is, I don't have a
> problem with using ModelB in ControllerA.
>
> I read that you want one click to save both Contact and related phone
> numbers.
> If so, I have a two things to offer (off the top of my head):
>
> You can possibly just switch to $this->Contact->saveAll($this->data)
> if your data is returned correctly from the form. Hint: one single
> form. You can check the cookbook for the details on how to use
> saveAll.
>
> You can reach the PhoneNumber model like $this->Contact->PhoneNumber
> and save data that way if you need to.
>
>
>
>
>
>
> On Sep 7, 8:28 pm, BrAt <[email protected]> wrote:
> > Hi , i am new to cakePHP , in order to learn php i am just making my
> > first test application which is
> > a simple telephone directory.
> > in my database there are two entities named contacts and phone_numbers
> > which has One-to-Many relationship.
> >
> > Now i have a form in contacts view "add.ctp" , i want that single form
> > to add Contact as well as the numbers. so by clicking add button
> > Contact, data should be stored in contacts table and phone number
> > should be stored in phone_numbers. i have added another form for phone
> > number and i m dynamically adding fields for input of phone number
> > using javascript.
> > But when the user clicks add button the data we put in phoneNumber
> > form also goes to ContactsController,
> >
> > Now is there any way to send my PhoneNumber data to
> > PhoneNumbersController to add action ,so that i can save that data in
> > phone_numbers table. or any other way to do this job.
> >
> > i ll be really thankfull.
> >
>


-- 
-- 
(¨`•.•´¨) I may be busy,
`•.¸(¨`•.•´¨)  but I assure you,
(¨`•.•´¨)¸.•´ you are always in my heart
`•.¸.•´


With Lots of Love.....

THANKS AND REGARDS

Jeffery Jacob

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