SlightPHP\Db::insert PHP Method

insert() public method

insert
public insert ( string | array | object $table, string | array | object $item = "", boolean $isreplace = false, boolean $isdelayed = false, string | array | object $update = [] ) : integer | boolean
$table string | array | object
$item string | array | object
$isreplace boolean
$isdelayed boolean
$update string | array | object
return integer | boolean int(lastInsertId or affectedRows)
    public function insert($table, $item = "", $isreplace = false, $isdelayed = false, $update = array())
    {
        $table = $this->__array2string($table);
        if ($isreplace == true) {
            $command = "REPLACE";
        } else {
            $command = "INSERT";
        }
        if ($isdelayed == true) {
            $command .= " DELAYED ";
        }
        $f = $this->__quote($item, ",");
        $sql = "{$command} INTO {$table} SET {$f} ";
        $v = $this->__quote($update, ",");
        if (!empty($v)) {
            $sql .= "ON DUPLICATE KEY UPDATE {$v}";
        }
        return $this->__query($sql);
    }