mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-12-25 04:58:59 +00:00
Added a getLastInsertedID method
This commit is contained in:
parent
1d70e373f3
commit
6498132ef2
@ -311,6 +311,25 @@ class DBLibrary {
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last inserted ID of a cursor
|
||||
*
|
||||
* @param Nothing
|
||||
* @return Integer The last inserted ID (0 for a failure)
|
||||
*/
|
||||
public function getLastInsertedID(){
|
||||
try {
|
||||
//Get & return last inserted ID
|
||||
return $this->db->lastInsertId();
|
||||
}
|
||||
catch(Exception $e){
|
||||
exit($this->echoException($e));
|
||||
}
|
||||
catch(PDOException $e){
|
||||
exit($this->echoPDOException($e));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get datas from a table
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user