MySQL SELECT Query/Statement.

@param string $table
@param array  $column
@param array  $arrayWhere
@param string $other

@return self type: array/error
323
public function select($table = '', $column = [], $arrayWhere = [], $other = '')
    {
        // handle column array data
        if (!is_array($column)) {
            $column = [];
        }
        // get field if pass otherwise use *
        $sField = count($column) > 0 ? implode(', ', $column) : '*';
        // check if table name not empty
        if (!empty($table)) {
            // if more then 0 array found in where array
            if (count($arrayWhere) > 0 && is_array($arrayWhere)) {
                // set class where array
                $this->data = $arrayWhere;
                // parse where array and get in temp var with key name and val
                if (strstr(key($arrayWhere), ' ')) {
                    $tmp = $this->customWhere($this->data);
                    // get where syntax with namespace
                    $where = $tmp['where'];
                } else {
                    $tmp = [];
                    foreach ($arrayWhere as $k => $v) {
                        $tmp[] = "$k = :s_$k";
                    }
                    // join temp array with AND condition
                    $where = implode(' AND ', $tmp);
                }
                // unset temp var
                unset($tmp);
                // set class sql property
                $this->sql = "SELECT $sField FROM `$table` WHERE $where $other;";
            } else {
                $this->sql = "SELECT $sField FROM `$table` $other;";  // if no where condition pass by user
            }

            // pdo prepare statement with sql query
            $this->STH = $this->prepare($this->sql);
            // if where condition has valid array number

            if (count($arrayWhere) > 0 && is_array($arrayWhere)) {
                $this->_bindPdoNameSpace($arrayWhere); // bind pdo param
            }

            // use try catch block to get pdo error
            try {
                // check if pdo execute
                if ($this->STH->execute()) {
                    // set class property with affected rows
                    $this->affectedRows = $this->STH->rowCount();
                    // set class property with sql result
                    $this->results = $this->STH->fetchAll();
                    // close pdo
                    $this->STH->closeCursor();
                    // return self object
                    return $this;
                } else {
                    self::error($this->STH->errorInfo());  // catch pdo error
                }
            } catch (\PDOException $e) {
                // get pdo error and pass on error method
                self::error($e->getMessage() . ': ' . __LINE__);
            } // end try catch block to get pdo error
        } else { // if table name empty
            self::error('Table name not found..');
        }
    }
565918
public function delete($table, array $where)
    {
        $query = "DELETE FROM `$table` WHERE ";

        $bind = array();
        foreach ($where as $column => $value) {
            $query .= "`$column` = ? AND ";
            $bind[] = $value;
        }

        $query = substr($query, 0, -5);

        // Prepare, bind and execute
        $statement = $this->prepare($query);
        foreach ($bind as $idx => $value) {
            $statement->bindValue(($idx + 1), $value, Database::typeOfValue($value));
        }

        return $statement->execute();
    }
823923
public function select($table, $where = '', $fields = '*', $order = '', $limit = null, $offset = '')
    {
        $query = "SELECT $fields FROM $table "
                 .($where ? " WHERE $where " : '')
                 .($order ? " ORDER BY $order " : '')
                 .($limit ? " LIMIT $limit " : '')
                 .(($offset && $limit ? " OFFSET $offset " : ''));
                 
        $this->prepare($query);
    }
31976
public function whereNotIn($column, array $values)
    {
        return $this->where(function ($query) use ($column, $values) {
            $query->whereNotIn($column, $values);
        });
    }
1063335
public function withColumns(array $columns) : Table
    {
        if ($this->columns === $columns) {
            return $this;
        }

        return new self($this->name, $columns, $this->indexes, $this->foreignKeys);
    }
526651
public static function delete($table,$where=[])
    {
        $bind=[];
        if(empty($where)){
            $where='';
        }else{
            $w=new Where($where);
            $where=' WHERE '.$w->parseWhere();
            $bind=array_merge($bind,$w->parseBind());
        }
        $sql=sprintf('DELETE FROM `:%s` %s',$table,$where);
        $bind=array_merge($bind,$bind);
        return self::execute($sql,$bind);
    }
826927
public function whereIn($column, array $values)
    {
        $this->where[] = [self::AND_WHERE_IN, $column, $values];

        return $this;
    }
1254027
public function replace($table, array $columns = null, array $where = null): ?array
    {
        if (\is_array($table)) {
            $columns = $this->getColumns($table, false);
            $table = $this->getTable($table);
            $where = $table;
        } elseif ($where) {
            $where = [SQL::WHERE => $where];
        }

        if (!\is_array($columns) || empty($columns)) {
            return null;
        }

        $map = [];
        $stack = [];

        foreach ($columns as $column => $replacements) {
            if (\is_array($replacements)) {
                foreach ($replacements as $old => $new) {
                    $mapKey = $this->mapKey();

                    $stack[] = $this->columnQuote($column) . ' = REPLACE(' . $this->columnQuote($column) . ', ' . $mapKey . 'a, ' . $mapKey . 'b)';

                    $map[$mapKey . 'a'] = [$old, PDO::PARAM_STR];
                    $map[$mapKey . 'b'] = [$new, PDO::PARAM_STR];
                }
            }
        }

        if ($stack === []) {
            return null;
        }

        $sql = 'UPDATE ' . $this->tableQuote($table) . ' SET ' .
            \implode(', ', $stack) . $this->suffixClause($where, $map);

        return [$sql, $map];
    }
663767
public static function select(array $columns = ['*'], ...$joinsColumns)
    {
        $query               = new static(Query\Type::SELECT);
        $query->columns['t'] = $columns;

        $alias = 'j1';
        foreach ($joinsColumns as $joinColumns) {
            $query->columns[$alias] = (array)$joinColumns;
            $alias++;
        }

        return $query;
    }
685996
public function select(
        $table,
        $conditions = null,
        $fields = null,
        $order = null,
        $limit = null,
        $offset = null
    )
    {
        if (is_null($fields)) {
            $fields = "*";
        }

        $queryString = "SELECT {$fields} FROM {$table} ";

        if (!is_null($conditions)) {
            $queryString .= "WHERE {$conditions} ";
        }

        if (!is_null($order)) {
            $queryString .= "ORDER BY {$order} ";
        }

        if (!is_null($limit)) {
            $queryString .= "LIMIT {$limit} ";
        }

        if (!is_null($offset) && !is_null($limit)) {
            $queryString .= "OFFSET {$offset} ";
        }


        $queryString .= ";";

        $this->query($queryString);

        return $this->countRows();
    }
944239
def select(table, cols="*", where=(), group="", order=(), limit=(), **kwargs):
    """"""
    where = dict(where, **kwargs).items()
    sql, args = makeSQL("SELECT", table, cols, where, group, order, limit)
    return execute(sql, args)
1272508
public static function selectSql($tablename, $fields, $where_clause=false) {
        $sql = "SELECT ";
        $first = true;
        foreach ( $fields as $field ) {
            if ( ! $first ) $sql .= ', ';
            $sql .= $field;
            $first = false;
        }
        $sql .= "\n FROM ".$tablename;
        if ( $where_clause && strlen($where_clause) > 0 ) $sql .= "\nWHERE ".$where_clause;
        return $sql;
    }
357566
public function select(string $columns, array $where = [], int $fetch_mode = PDO::FETCH_ASSOC) : self {
    $this->query_builder->resetProperties();
    $this->query_builder->setMode('select');
    $this->query_builder->setColumns($columns);

    if (!empty($where)) {
      $this->query_builder->setWhere($where);
      $where = $this->formatWhereData($where);
    }

    try {
      $stmt = parent::prepare($this->query_builder->getQuery());
      $stmt->execute($where);
      $this->results = $stmt->fetchAll($fetch_mode);
    } catch (PDOException $e) {
      $this->pdo_exception = $e;
      $this->query_failed = true;
    }

    return $this;
  }
328774
function selectByIdWhereSql () {
    // get id column
    var idColumn = this.model.columnName('id')
    // every where statement will begin with the alias and column name
    var columnSql = `${this.alias}.${this.quoteName(idColumn)}`
    // sql for where query
    var sql
    // if ids are array build in query
    if (Array.isArray(this.args.where.id)) {
        var i = 0
        // get placeholder for each in value
        var placeholders = _.map(this.args.where.id, id => {
            // get param name
            var paramName = `id${i}`
            // increment param counter
            i++
            // set value for param placeholder
            this.params[paramName] = id
            // create placeholder
            return this.unhexId(`:${paramName}`)
        })
        // return where sql
        sql = `WHERE ${columnSql} IN(${placeholders.join(', ')})`
    }
    // otherwise build equals query
    else {
        // set value for param placeholder
        this.params.id = this.args.where.id
        // get place holder
        var placeholder = this.unhexId(':id')
        // return where sql
        sql = `WHERE ${columnSql} = ${placeholder}`
    }
    // and deleted check if d column exists and set in args
    if (defined(this.model.columns.d) && typeof this.args.where.isDeleted === 'boolean') {
        sql += ` AND ${this.alias}.d = ${this.args.where.isDeleted ? 1 : 0}`
    }

    return sql
}
269466
private function _select($column)
    {
        if ($column === 'all' || $column == '*') {
            $this->selectColumns = $this->quoteIdentifier(
                    self::cyrus()->getTableName()
                ).'.*';
        } else {
            if (string_has($column, 'as') || string_has($column, 'AS')) {
                return $this->selectExpr($column);
            }

            $this->selectColumns = (string) str_replace(' ', '', $this->quoteIdentifier(explode(',', $column)));
        }

        return $this;
    }
112289
public function selectFromTable($table, $fields)
    {
        $fieldExpressions = array_map(function ($item) use ($table) {
            return Convert::symbol2sql("{$table}.{$item}");
        }, $fields);

        $this->query->setSelect($fieldExpressions);

        return $this;
    }
477469
public function select($columns)
    {
        settype($columns, 'array');
        $this->columns = array_unique(array_merge($this->columns, $columns));
        $this->operation = array('type' => self::QUERY_SELECT_DEFAULT, 'value' => '');

        return $this;
    }