Jump to:

10979 Posts in 2722 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » Get last inserted id

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1319 Views
  • m-phil
    Avatar
    Community Member
    37 Posts

    Get last inserted id Link to this post

    Hey, is there a db function that gives me the last inserted id or better a query function that returns the new id directly?
    I got a query excuted via DB::query('INSERT INTO...'); and need the id of the entry.
    The return param doesn't give it. I know that I can get it with a new select query but, it isn't the best way I think.
    Thx

  • UncleCheese
    Avatar
    4085 Posts

    Re: Get last inserted id Link to this post

    DB::getGeneratedID($table);

    1319 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.