public function insert($q, $data)
    {
        if (is_string($q)) {
            $this->defaults['table'] = $q;
            $q = [];
        }
        extract($this->defaults);
        extract($q);

        if (!$table)
            throw new Exception("table [$tabel] not defined", 1);

        $sql =  'INSERT INTO ' . $table . ' ' .
                '(' . implode(', ', array_keys($data)) . ') ' .
                'VALUES ( :' . implode(', :', array_keys($data)) . ');';

        return $this->query($sql, $data);
    }
public function insert($q, $data)
    {
        if (is_string($q)) {
            $this->defaults['table'] = $q;
            $q = [];
        }
        extract($this->defaults);
        extract($q);

        if (!$table)
            throw new Exception("table [$tabel] not defined", 1);

        $sql =  'INSERT INTO ' . $table . ' ' .
                '(' . implode(', ', array_keys($data)) . ') ' .
                'VALUES ( :' . implode(', :', array_keys($data)) . ');';

        return $this->query($sql, $data);
    }
public function insert ( $ q , $ data ) { if ( is_string ( $ q ) ) { $ this -> defaults [ 'table' ] = $ q ; $ q = [ ] ; } extract ( $ this -> defaults ) ; extract ( $ q ) ; if ( ! $ table ) throw new Exception ( "table [$tabel] not defined" , 1 ) ; $ sql = 'INSERT INTO ' . $ table . ' ' . '(' . implode ( ', ' , array_keys ( $ data ) ) . ') ' . 'VALUES ( :' . implode ( ', :' , array_keys ( $ data ) ) . ');' ; return $ this -> query ( $ sql , $ data ) ; }
inserts a record

@param string|array $q    name of table or array containg additional
information as well
@param array        $data associative array with binding data
inserts a record