src/MVC/DataBase/Model.php
protected function insert(array $data = array())
    {
        $fields = array();
        $values = array();
        
        foreach ($data as $field => $value) {
            $fields[] = $field;
            $values[] = '?';
        }
        
        $sql = "INSERT INTO $this->_table " 
                . "(" . implode(', ', $fields) . ")"
                . "VALUES (" . implode(', ', $values) . ")";
                
        $pdos = $this->_pdo->prepare($sql);
        
        $pdos->execute(array_values($data));
        
        return $pdos->statement()->rowCount();
    }
protected function insert(array $data = array())
    {
        $fields = array();
        $values = array();
        
        foreach ($data as $field => $value) {
            $fields[] = $field;
            $values[] = '?';
        }
        
        $sql = "INSERT INTO $this->_table " 
                . "(" . implode(', ', $fields) . ")"
                . "VALUES (" . implode(', ', $values) . ")";
                
        $pdos = $this->_pdo->prepare($sql);
        
        $pdos->execute(array_values($data));
        
        return $pdos->statement()->rowCount();
    }
protected function insert ( array $ data = array ( ) ) { $ fields = array ( ) ; $ values = array ( ) ; foreach ( $ data as $ field => $ value ) { $ fields [ ] = $ field ; $ values [ ] = '?' ; } $ sql = "INSERT INTO $this->_table " . "(" . implode ( ', ' , $ fields ) . ")" . "VALUES (" . implode ( ', ' , $ values ) . ")" ; $ pdos = $ this -> _pdo -> prepare ( $ sql ) ; $ pdos -> execute ( array_values ( $ data ) ) ; return $ pdos -> statement ( ) -> rowCount ( ) ; }
Function SQL INSERT
@access protected
@param array $data
@return int
Function SQL INSERT