MySQL::GetLastInsertID PHP Method

GetLastInsertID() public method

Returns the last autonumber ID field from a previous INSERT query
public GetLastInsertID ( ) : integer
return integer ID number from previous INSERT query
    public function GetLastInsertID()
    {
        return $this->last_insert_id;
    }

Usage Example

Example #1
0
 /**
  * @param $data
  * @return bool|int
  */
 public function membership_role_create($data)
 {
     $values = array();
     foreach ($data as $key => $value) {
         if ($key == 'name') {
             $values[$key] = MySQL::SQLValue($value);
         } else {
             $values[$key] = MySQL::SQLValue($value, MySQL::SQLVALUE_NUMBER);
         }
     }
     $table = $this->kga['server_prefix'] . "membershipRoles";
     $result = $this->conn->InsertRow($table, $values);
     if (!$result) {
         $this->logLastError('membership_role_create');
         return false;
     }
     return $this->conn->GetLastInsertID();
 }
All Usage Examples Of MySQL::GetLastInsertID