Wednesday, August 8, 2012

Re: Select Last Record From Database

In your beforeSave callback you could include a cal that does something like - SELECT MAX(invoice_number) FROM table, then in your code, generate the next number. Though if the code is going to be used by many people simultaneously, you would need to create a unique index on that column, to prevent duplicates.

On Friday, August 3, 2012 2:02:15 AM UTC-4, Mr. Manager wrote:
Dear All,

Current I want to generate invoice number like INV00001 and so I would like to get the last value of filed no (stand for invoice number) in order to generator one increment when we create a new invoice.

I am looking forward to hearing from you as soon as possible.

Best Regard,
Mr. Manager,

--
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+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

No comments: