src/DB/PDO/TableWriter.php
public function insert( $data = array(), $stripTags = TRUE ){
		$columns	= array();
		$values		= array();
		foreach( $this->columns as $column ){														//  iterate Columns
			if( !isset( $data[$column] ) )															//  no Data given for Column
				continue;
			$value = $data[$column];
			if( $stripTags )
				$value = strip_tags( $value );
			$columns[$column]	= $column;
			$values[$column]	= $this->secureValue( $value );
		}
		if( $this->isFocused() ){																	//  add focused indices to data
			foreach( $this->focusedIndices as $index => $value ){									//  iterate focused indices
				if( isset( $columns[$index] ) )														//  Column is already set
					continue;
				if( $index == $this->primaryKey )													//  skip primary key
					continue;
				$columns[$index]	= $index;														//  add key
				$values[$index]		= $this->secureValue( $value );									//  add value
			}
		}
		$columns	= $this->getColumnEnumeration( $columns );										//  get enumeration of masked column names
		$values		= implode( ', ', array_values( $values ) );
		$query		= 'INSERT INTO '.$this->getTableName().' ('.$columns.') VALUES ('.$values.')';
		$this->dbc->exec( $query );
		return $this->dbc->lastInsertId();
	}
public function insert( $data = array(), $stripTags = TRUE ){
		$columns	= array();
		$values		= array();
		foreach( $this->columns as $column ){														//  iterate Columns
			if( !isset( $data[$column] ) )															//  no Data given for Column
				continue;
			$value = $data[$column];
			if( $stripTags )
				$value = strip_tags( $value );
			$columns[$column]	= $column;
			$values[$column]	= $this->secureValue( $value );
		}
		if( $this->isFocused() ){																	//  add focused indices to data
			foreach( $this->focusedIndices as $index => $value ){									//  iterate focused indices
				if( isset( $columns[$index] ) )														//  Column is already set
					continue;
				if( $index == $this->primaryKey )													//  skip primary key
					continue;
				$columns[$index]	= $index;														//  add key
				$values[$index]		= $this->secureValue( $value );									//  add value
			}
		}
		$columns	= $this->getColumnEnumeration( $columns );										//  get enumeration of masked column names
		$values		= implode( ', ', array_values( $values ) );
		$query		= 'INSERT INTO '.$this->getTableName().' ('.$columns.') VALUES ('.$values.')';
		$this->dbc->exec( $query );
		return $this->dbc->lastInsertId();
	}
public function insert ( $ data = array ( ) , $ stripTags = TRUE ) { $ columns = array ( ) ; $ values = array ( ) ; foreach ( $ this -> columns as $ column ) { //  iterate Columns if ( ! isset ( $ data [ $ column ] ) ) //  no Data given for Column continue ; $ value = $ data [ $ column ] ; if ( $ stripTags ) $ value = strip_tags ( $ value ) ; $ columns [ $ column ] = $ column ; $ values [ $ column ] = $ this -> secureValue ( $ value ) ; } if ( $ this -> isFocused ( ) ) { //  add focused indices to data foreach ( $ this -> focusedIndices as $ index => $ value ) { //  iterate focused indices if ( isset ( $ columns [ $ index ] ) ) //  Column is already set continue ; if ( $ index == $ this -> primaryKey ) //  skip primary key continue ; $ columns [ $ index ] = $ index ; //  add key $ values [ $ index ] = $ this -> secureValue ( $ value ) ; //  add value } } $ columns = $ this -> getColumnEnumeration ( $ columns ) ; //  get enumeration of masked column names $ values = implode ( ', ' , array_values ( $ values ) ) ; $ query = 'INSERT INTO ' . $ this -> getTableName ( ) . ' (' . $ columns . ') VALUES (' . $ values . ')' ; $ this -> dbc -> exec ( $ query ) ; return $ this -> dbc -> lastInsertId ( ) ; }
Inserts data into this table and returns ID.
@access		public
@param		array		$data			associative array of data to store
@param		bool		$stripTags		Flag: strip HTML Tags from values
@return		int			ID of inserted row
Inserts data into this table and returns ID .