Thanks guys!
I used your advice running a query on the latest ID. I dont have to worry
about a race condition so it works great, thanks!
--
View this message in context:
http://cakephp.1045679.n5.nabble.com/Get-the-last-insert-id-tp3236536p3252664.html
Sent from the CakePHP mailing list
What if I made the insert 20 days ago, how could I get the last id?
I want to get the current ID value in the beforeSave function to apend
it to a file I'm saving... Any thouhts?
kevando
On Oct 25, 11:17 pm, Larry E. Masters php...@gmail.com wrote:
$this-Model-save();
$id = $this-Model-id;
on the can.
thanks,
Kev
--
View this message in context:
http://cakephp.1045679.n5.nabble.com/Get-the-last-insert-id-tp3236536p3248988.html
Sent from the CakePHP mailing list archive at Nabble.com.
Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP
On Nov 4, 3:50 pm, Mike Karthauser mi...@brightstorm.co.uk wrote:
On Wed, November 3, 2010 7:05 pm, kevando wrote:
What about if my last insert/save was 20 days ago?
why don't you insert and then update if you want to do that. you can
easily wrap that in a transaction. anything else you do
you could use
find-first() with order: id=DESC
this would get you the last insert id, no matter how many days passed
although the above race conditions might result in problems (depending
on the usage of this id)
On 4 Nov., 16:28, AD7six andydawso...@gmail.com wrote:
On Nov 4, 3:50 pm, Mike
@Kevando - If you want the ID of something that happened 20 days ago,
you cant get the last insert ID. That only applies when you literally
just ran a query and need to get the ID.
If you want it from 20 days ago, do a find query and order by DESC
limit 1.
On Nov 4, 8:36 am, euromark dereurom
Hello I am using cakePHP 1.3 and I am unable to retreive the last
inserted row's id. I actually am using $this-Model-id to retreive
the last inserted id but I am unable to get the id. When tried to
check what is return type, it says as bool(false), which means nothing
is returned.
Here I am
after your save statement..
$var = $this-Contact-lastInsertId();
On Mon, Oct 25, 2010 at 7:48 AM, macha srin...@gmail.com wrote:
Hello I am using cakePHP 1.3 and I am unable to retreive the last
inserted row's id. I actually am using $this-Model-id to retreive
the last inserted id but I am
On Mon, Oct 25, 2010 at 11:51 PM, Robert J. Maiolo rmai...@gmail.com wrote:
after your save statement..
$var = $this-Contact-lastInsertId();
It's getInsertID(). You're probably thinking of getLastInsertID(),
which has been deprecated.
Check out the new CakePHP Questions site
$this-Model-save();
$id = $this-Model-id;
--
Larry E. Masters
On Mon, Oct 25, 2010 at 11:14 PM, cricket zijn.digi...@gmail.com wrote:
On Mon, Oct 25, 2010 at 11:51 PM, Robert J. Maiolo rmai...@gmail.com
wrote:
after your save statement..
$var = $this-Contact-lastInsertId();
It's
10 matches
Mail list logo