public function insert($table, array $data)
    {
        $nameFields = join(',', array_keys($data));
        $preparedValues = $this->prepareValues($data);
        $keyValues = join(",", array_keys($preparedValues));
        $queryString = "INSERT INTO {$table} ({$nameFields}) VALUES ({$keyValues});";

        $this->query($queryString, $preparedValues);

        return $this->getInsertId();
    }
public function insert($table, array $data)
    {
        $nameFields = join(',', array_keys($data));
        $preparedValues = $this->prepareValues($data);
        $keyValues = join(",", array_keys($preparedValues));
        $queryString = "INSERT INTO {$table} ({$nameFields}) VALUES ({$keyValues});";

        $this->query($queryString, $preparedValues);

        return $this->getInsertId();
    }
public function insert ( $ table , array $ data ) { $ nameFields = join ( ',' , array_keys ( $ data ) ) ; $ preparedValues = $ this -> prepareValues ( $ data ) ; $ keyValues = join ( "," , array_keys ( $ preparedValues ) ) ; $ queryString = "INSERT INTO {$table} ({$nameFields}) VALUES ({$keyValues});" ; $ this -> query ( $ queryString , $ preparedValues ) ; return $ this -> getInsertId ( ) ; }
Perform a INSERT statement

@param string $table
@param array $data

@return int last inserted id
Perform a INSERT statement