Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How can I get last insert id?
  • Hey, how can I get last insert id with ORM?? thank you!
  • It's set as the object's ID after you saved it.
    $obj = new Model_Example();
    $obj->save();
    $id = $obj->id;
    
  • Thank you for asking this! And thanks for the answer, I knew it had to be something simple.
  • and relationship? $usuario = new Usuario(\Input::post('usuario'));
    $usuario->medico = new Medico(\Input::post('medico')); $usuario->save(); $id = $usuario->medico->id; #not work

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion