Why is $this->query() to be avoided?  I'm trying to use it but I'm
having trouble getting the values it produces from the array.

Is theres a better way for me to query tables?

oh, what I' trying to do is count the number of rows in a table bassed
on a project ID, that I get from a user ID.

On Jul 9, 11:49 pm, Geoff Ford <[EMAIL PROTECTED]> wrote:
> To clarify AD a bit
>
> Where you have:
> $this->query("UPDATE customers SET password='$pass' WHERE
> id='$id'");
>
> You should have:
> $this->id = $id;
> $this->saveField('password', $pass);
>
> You should try to avoid using $this->query() unless you really have
> to.
>
> To query the inventory table you need an Inventory model.  THen in
> your controller you can do:
> $this->Customer->changepass($id, $pass);
> $this->Inventory->findAll(array('customer_id' => $id));
>
> Or whatever it is you need to do.  Models should be independent, so
> one model should not query anothers table.  It should be done in the
> controller.
>
> I think you need to go back and read the manual a bit more.  This is
> all explained quite well.
>
> Geoff
> --http://lemoncake.wordpress.com
>
> On Jul 10, 2:12 pm, reeta <[EMAIL PROTECTED]> wrote:
>
> > Hi AD ! thanks for the help but i want to know if i want to run query
> > on another model then how could i do this?suppose i want to run
> > query() from inventory table in customer model class ,then how could i
> > do this?and another question is i m not getting value for last insert
> > id.There is a function named as getLastInsertId(),but it is not giving
> > result.
>
> > On Jul 9, 2:37 pm, AD7six <[EMAIL PROTECTED]> wrote:
>
> > > On Jul 9, 11:06 am, reeta <[EMAIL PROTECTED]> wrote:
> > > <snip>
>
> > > > now in model class:-
> > > > function changepass($pass,$id)
> > > > {
> > > >  $this->query("UPDATE customers SET password='$pass' WHERE
> > > > id='$id'");
>
> > > Why are you using query instead of save or saveField..?
> > > If you don't want to use the features of the framework, why use the
> > > framework?
>
> > > > This is working well,but if i want to run query on another table then
> > > > how can i do this?
>
> > > You call save (or whatever) on the other model.
>
> > > hth,
>
> > > AD


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