Here is what i have done so far but it's not working
$branch="SEN";
$ret = $this->Client->findBySQL("Select id from clients
order by id
DESC LIMIT 1");
$lastId=$ret[0]['id'];
$act=$lastId + 1;
$yr=date("y");
$account="$branch-$yr-00$act";
$this->data['Client']['acct_numb'] =
$account;
$this->Client->create();
if ($this->Client->save($this->data) etc....
On Feb 9, 5:31 pm, Salam Fall <[EMAIL PROTECTED]> wrote:
> Nubee here
>
> How do I find the last record in the database and have it's ID value
> in the controller and be able to manipulate it mathematically.
>
> Because all i want to do is put the ID of the last record of the
> Clients table add 1 to it and append the result to a string that will
> be used to create the Client account number.
>
> Also if I want to create my own custom functions or classes to add to
> my cake APP how do I do that.
>
> Thanks for your help.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---