1. 26.
    0
    public function autoExecute($table, $values, $type, $where = false, $limit = false)
    {
    if (!sizeof($values))
    return true;

    if (strtoupper($type) == 'INSERT')
    {
    $query = 'INSERT INTO stable (';
    foreach ($values AS $key => $value)
    $query .= ' skey ,';
    $query = rtrim($query, ',').') VALUES (';
    foreach ($values AS $key => $value)
    $query .= '.$value.,';
    $query = rtrim($query, ',').')';
    if ($limit)
    $query .= ' LIMIT '.intval($limit);
    return $this->q($query);
    }
    elseif (strtoupper($type) == 'UPDATE')
    {
    $query = 'UPDATE stable SET ';
    foreach ($values AS $key => $value)
    $query .= ' skey = .$value.,';
    $query = rtrim($query, ',');
    if ($where)
    $query .= ' WHERE '.$where;
    if ($limit)
    $query .= ' LIMIT '.intval($limit);
    return $this->q($query);
    }

    return false;
    }
    ···
   tümünü göster