protected function buildInsertStatement($data,$table=null) {
		if (!$table) {
			$table = $this->primaryTable;
		}
		$bindparams = array();
		$sql_fields = NULL;
		$sql_values = NULL;
		foreach ($data as $field=>$value) {
			$sql_fields .= "{$field},";
			$sql_values .= ":{$field},";
			$bindparams[":{$field}"] = $value;
		}
		$sql_fields = rtrim($sql_fields,',');
		$sql_values = rtrim($sql_values,',');
		$sql = "INSERT INTO {$table} ({$sql_fields}) VALUES ({$sql_values})";
		if ($this->executeUpdate($sql,$bindparams)) {
			return $this->getLastInsertId();
		}
		return false;
	}
protected function buildInsertStatement($data,$table=null) {
		if (!$table) {
			$table = $this->primaryTable;
		}
		$bindparams = array();
		$sql_fields = NULL;
		$sql_values = NULL;
		foreach ($data as $field=>$value) {
			$sql_fields .= "{$field},";
			$sql_values .= ":{$field},";
			$bindparams[":{$field}"] = $value;
		}
		$sql_fields = rtrim($sql_fields,',');
		$sql_values = rtrim($sql_values,',');
		$sql = "INSERT INTO {$table} ({$sql_fields}) VALUES ({$sql_values})";
		if ($this->executeUpdate($sql,$bindparams)) {
			return $this->getLastInsertId();
		}
		return false;
	}
protected function buildInsertStatement ( $ data , $ table = null ) { if ( ! $ table ) { $ table = $ this -> primaryTable ; } $ bindparams = array ( ) ; $ sql_fields = NULL ; $ sql_values = NULL ; foreach ( $ data as $ field => $ value ) { $ sql_fields .= "{$field}," ; $ sql_values .= ":{$field}," ; $ bindparams [ ":{$field}" ] = $ value ; } $ sql_fields = rtrim ( $ sql_fields , ',' ) ; $ sql_values = rtrim ( $ sql_values , ',' ) ; $ sql = "INSERT INTO {$table} ({$sql_fields}) VALUES ({$sql_values})" ; if ( $ this -> executeUpdate ( $ sql , $ bindparams ) ) { return $ this -> getLastInsertId ( ) ; } return false ; }
Builds and executes an insert statement
@param mixed[] $data An associative array (ColumnName->Value) of data representing the new DB record
@param string $table Optional - The table to insert the new record into. Defaults to $primaryTable
@return int/false Returns the ID of the new record on success, false on failure
Builds and executes an insert statement