src/DB/TableWriter.php
public function addData( $data = array(), $stripTags = TRUE, $debug = 1 )
	{
		if( sizeof( $this->fields ) )
		{
			$keys	= array();
			$vals	= array();
			foreach( $this->fields as $field )
			{
				if( !isset( $data[$field] ) )
					continue;
				$value	= $this->secureValue( $data[$field], $stripTags );
				$keys[$field] = '`'.$field.'`';
				$vals[$field] = '"'.$value.'"';
			}
			if( $this->isFocused() && in_array( $this->focusKey, $this->getForeignKeys() ) && !in_array( $this->focusKey, $keys ) )
			{
				$keys[$this->focusKey]	= $this->focusKey;
				$vals[$this->focusKey]	= $this->focus;
			}
			$keys	= implode( ", ", array_values( $keys ) );
			$vals	= implode( ", ", array_values( $vals ) );
			$query	= "INSERT INTO ".$this->getTableName()." (".$keys.") VALUES (".$vals.")";
			$this->dbc->Execute( $query, $debug );
			$id	= $this->dbc->getInsertId();
			$this->focusPrimary( $id );
			return $id;
		}
		return FALSE;
	}
public function addData( $data = array(), $stripTags = TRUE, $debug = 1 )
	{
		if( sizeof( $this->fields ) )
		{
			$keys	= array();
			$vals	= array();
			foreach( $this->fields as $field )
			{
				if( !isset( $data[$field] ) )
					continue;
				$value	= $this->secureValue( $data[$field], $stripTags );
				$keys[$field] = '`'.$field.'`';
				$vals[$field] = '"'.$value.'"';
			}
			if( $this->isFocused() && in_array( $this->focusKey, $this->getForeignKeys() ) && !in_array( $this->focusKey, $keys ) )
			{
				$keys[$this->focusKey]	= $this->focusKey;
				$vals[$this->focusKey]	= $this->focus;
			}
			$keys	= implode( ", ", array_values( $keys ) );
			$vals	= implode( ", ", array_values( $vals ) );
			$query	= "INSERT INTO ".$this->getTableName()." (".$keys.") VALUES (".$vals.")";
			$this->dbc->Execute( $query, $debug );
			$id	= $this->dbc->getInsertId();
			$this->focusPrimary( $id );
			return $id;
		}
		return FALSE;
	}
public function addData ( $ data = array ( ) , $ stripTags = TRUE , $ debug = 1 ) { if ( sizeof ( $ this -> fields ) ) { $ keys = array ( ) ; $ vals = array ( ) ; foreach ( $ this -> fields as $ field ) { if ( ! isset ( $ data [ $ field ] ) ) continue ; $ value = $ this -> secureValue ( $ data [ $ field ] , $ stripTags ) ; $ keys [ $ field ] = '`' . $ field . '`' ; $ vals [ $ field ] = '"' . $ value . '"' ; } if ( $ this -> isFocused ( ) && in_array ( $ this -> focusKey , $ this -> getForeignKeys ( ) ) && ! in_array ( $ this -> focusKey , $ keys ) ) { $ keys [ $ this -> focusKey ] = $ this -> focusKey ; $ vals [ $ this -> focusKey ] = $ this -> focus ; } $ keys = implode ( ", " , array_values ( $ keys ) ) ; $ vals = implode ( ", " , array_values ( $ vals ) ) ; $ query = "INSERT INTO " . $ this -> getTableName ( ) . " (" . $ keys . ") VALUES (" . $ vals . ")" ; $ this -> dbc -> Execute ( $ query , $ debug ) ; $ id = $ this -> dbc -> getInsertId ( ) ; $ this -> focusPrimary ( $ id ) ; return $ id ; } return FALSE ; }
Inserting data into this table.
@access		public
@param		array		$data			associative array of data to store
@param		bool		$stripTags		strips HTML Tags from values
@param		int			$debug			deBug Level (16:die after, 8:die before, 4:remark, 2:echo, 1:count[default])
@return		bool
Inserting data into this table .