public function insertRecord($tablename, $parameters, $ignore = false)
    {
        if (empty($parameters))
            throw new DatabaseException('insertRecord: no parameters.');

        $insert_fields = array();
        $insert_values = array();

        foreach ($parameters as $name => $value) {
            $insert_fields[] = $name;
            $insert_values[] = $this->quote($value);
        }

        $sql = "INSERT ".( $ignore ? "IGNORE " : "") . "INTO  ".
                 $tablename . " (" . implode(",", $insert_fields) .
                ") VALUES (".
                implode(",", $insert_values) . ")";

        return $this->write($sql);
    }
public function insertRecord($tablename, $parameters, $ignore = false)
    {
        if (empty($parameters))
            throw new DatabaseException('insertRecord: no parameters.');

        $insert_fields = array();
        $insert_values = array();

        foreach ($parameters as $name => $value) {
            $insert_fields[] = $name;
            $insert_values[] = $this->quote($value);
        }

        $sql = "INSERT ".( $ignore ? "IGNORE " : "") . "INTO  ".
                 $tablename . " (" . implode(",", $insert_fields) .
                ") VALUES (".
                implode(",", $insert_values) . ")";

        return $this->write($sql);
    }
public function insertRecord ( $ tablename , $ parameters , $ ignore = false ) { if ( empty ( $ parameters ) ) throw new DatabaseException ( 'insertRecord: no parameters.' ) ; $ insert_fields = array ( ) ; $ insert_values = array ( ) ; foreach ( $ parameters as $ name => $ value ) { $ insert_fields [ ] = $ name ; $ insert_values [ ] = $ this -> quote ( $ value ) ; } $ sql = "INSERT " . ( $ ignore ? "IGNORE " : "" ) . "INTO  " . $ tablename . " (" . implode ( "," , $ insert_fields ) . ") VALUES (" . implode ( "," , $ insert_values ) . ")" ; return $ this -> write ( $ sql ) ; }
Provides a convenience method for inserting an single row of columns
and values into a database table

@param string  $tablename  Table to insert record
@param array   $parameters Associative array of columns and values, ex.
<code>
array(
'col1' => 'value of col1',
'col2' => 'value of col2'
)
</code>
@param boolean $ignore     If true, then we'll ignore key conflicts on insert. Default: false

@return int Insert id of the record
@throws DatabaseException if tablename or parameters array is empty
Provides a convenience method for inserting an single row of columns and values into a database table