public function Insert($table, $data = array())
    {
        if (empty($table) || empty($data)) {
            return false;
        }

        //Before we set the columns, make sure we only use the column that re meant to be filled.
        foreach ($data as $key => $val) {
            if (empty($val)) {
                unset($data[$key]);
            }
        }

        //Get all the columns that are being set
        $columns = array_keys($data);

        //If the columns are not empty, proceed with the save
        if (!empty($columns)) {
            //Create a newInsert object
            $insert = $this->queryFactory->newInsert();

            //Set the table
            $insert->into($table);

            //Set the columns
            $insert->cols($columns);

            //Bind the values to be saved
            $insert->bindValues($data);

            //return the insert id
            return $this->exec($insert->getStatement(), $insert->getBindValues());

        }

        return false;
    }
public function Insert($table, $data = array())
    {
        if (empty($table) || empty($data)) {
            return false;
        }

        //Before we set the columns, make sure we only use the column that re meant to be filled.
        foreach ($data as $key => $val) {
            if (empty($val)) {
                unset($data[$key]);
            }
        }

        //Get all the columns that are being set
        $columns = array_keys($data);

        //If the columns are not empty, proceed with the save
        if (!empty($columns)) {
            //Create a newInsert object
            $insert = $this->queryFactory->newInsert();

            //Set the table
            $insert->into($table);

            //Set the columns
            $insert->cols($columns);

            //Bind the values to be saved
            $insert->bindValues($data);

            //return the insert id
            return $this->exec($insert->getStatement(), $insert->getBindValues());

        }

        return false;
    }
public function Insert ( $ table , $ data = array ( ) ) { if ( empty ( $ table ) || empty ( $ data ) ) { return false ; } //Before we set the columns, make sure we only use the column that re meant to be filled. foreach ( $ data as $ key => $ val ) { if ( empty ( $ val ) ) { unset ( $ data [ $ key ] ) ; } } //Get all the columns that are being set $ columns = array_keys ( $ data ) ; //If the columns are not empty, proceed with the save if ( ! empty ( $ columns ) ) { //Create a newInsert object $ insert = $ this -> queryFactory -> newInsert ( ) ; //Set the table $ insert -> into ( $ table ) ; //Set the columns $ insert -> cols ( $ columns ) ; //Bind the values to be saved $ insert -> bindValues ( $ data ) ; //return the insert id return $ this -> exec ( $ insert -> getStatement ( ) , $ insert -> getBindValues ( ) ) ; } return false ; }
Saves the data in the table with a new id;

INSERT INTO tbl_temp2 (fld_id)
SELECT tbl_temp1.fld_order_id
FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;

@param $table
@param array $data

@return mixed
Saves the data in the table with a new id ;