samples/PhotoAlbum/lib/rb.php
protected function insertRecord( $table, $insertcolumns, $insertvalues ) {
		$default = $this->defaultValue;
		$suffix = $this->getInsertSuffix($table);
		$table = $this->safeTable($table);
		if (count($insertvalues)>0 && is_array($insertvalues[0]) && count($insertvalues[0])>0) {
			foreach($insertcolumns as $k=>$v) {
				$insertcolumns[$k] = $this->safeColumn($v);
			}
			$insertSQL = "INSERT INTO $table ( id, ".implode(',',$insertcolumns)." ) VALUES 
			( $default, ". implode(',',array_fill(0,count($insertcolumns),' ? '))." ) $suffix";

			foreach($insertvalues as $i=>$insertvalue) {
				$ids[] = $this->adapter->getCell( $insertSQL, $insertvalue, $i );
			}
			$result = count($ids)===1 ? array_pop($ids) : $ids;
		}
		else {
			$result = $this->adapter->getCell( "INSERT INTO $table (id) VALUES($default) $suffix");
		}
		if ($suffix) return $result;
		$last_id = $this->adapter->getInsertID();
		return $last_id;
	}
protected function insertRecord( $table, $insertcolumns, $insertvalues ) {
		$default = $this->defaultValue;
		$suffix = $this->getInsertSuffix($table);
		$table = $this->safeTable($table);
		if (count($insertvalues)>0 && is_array($insertvalues[0]) && count($insertvalues[0])>0) {
			foreach($insertcolumns as $k=>$v) {
				$insertcolumns[$k] = $this->safeColumn($v);
			}
			$insertSQL = "INSERT INTO $table ( id, ".implode(',',$insertcolumns)." ) VALUES 
			( $default, ". implode(',',array_fill(0,count($insertcolumns),' ? '))." ) $suffix";

			foreach($insertvalues as $i=>$insertvalue) {
				$ids[] = $this->adapter->getCell( $insertSQL, $insertvalue, $i );
			}
			$result = count($ids)===1 ? array_pop($ids) : $ids;
		}
		else {
			$result = $this->adapter->getCell( "INSERT INTO $table (id) VALUES($default) $suffix");
		}
		if ($suffix) return $result;
		$last_id = $this->adapter->getInsertID();
		return $last_id;
	}
protected function insertRecord ( $ table , $ insertcolumns , $ insertvalues ) { $ default = $ this -> defaultValue ; $ suffix = $ this -> getInsertSuffix ( $ table ) ; $ table = $ this -> safeTable ( $ table ) ; if ( count ( $ insertvalues ) > 0 && is_array ( $ insertvalues [ 0 ] ) && count ( $ insertvalues [ 0 ] ) > 0 ) { foreach ( $ insertcolumns as $ k => $ v ) { $ insertcolumns [ $ k ] = $ this -> safeColumn ( $ v ) ; } $ insertSQL = "INSERT INTO $table ( id, " . implode ( ',' , $ insertcolumns ) . " ) VALUES 
			( $default, " . implode ( ',' , array_fill ( 0 , count ( $ insertcolumns ) , ' ? ' ) ) . " ) $suffix" ; foreach ( $ insertvalues as $ i => $ insertvalue ) { $ ids [ ] = $ this -> adapter -> getCell ( $ insertSQL , $ insertvalue , $ i ) ; } $ result = count ( $ ids ) === 1 ? array_pop ( $ ids ) : $ ids ; } else { $ result = $ this -> adapter -> getCell ( "INSERT INTO $table (id) VALUES($default) $suffix" ) ; } if ( $ suffix ) return $ result ; $ last_id = $ this -> adapter -> getInsertID ( ) ; return $ last_id ; }
Inserts a record into the database using a series of insert columns
and corresponding insertvalues. Returns the insert id.

@param string $table			  table to perform query on
@param array  $insertcolumns columns to be inserted
@param array  $insertvalues  values to be inserted

@return integer $insertid	  insert id from driver, new record id
Inserts a record into the database using a series of insert columns and corresponding insertvalues . Returns the insert id .