I'm using Kohana 3 framework with Mysql stored procedures. How can I get id of the last inserted record? Here's the code:
class Model_MyModel extends Kohana_Model
{
public function insertNew($param1, $param2)
{
$result = $this->_db->query(Database::INSERT, 'CALL insertNew('.$param1.', '.$param2.', false)';
return $result;
}
...
...
}
Documentation says, the query() method returns an array with the last insert id and affected rows number, when executing an insert query. When I call: print_r($result) I'm getting: Array ( [0] => 0 [1] => 1 ) The insert_id key is 0, though I'm having many records in the db. What I'm doing wrong?