public function selectAll($table, $conditions = false, $select = '*', $limit = null)
    {
        $params = array();
        $query = "SELECT $select FROM " . $this->getTable($table) . ' ';

        if (is_array($conditions)) {
            if (!empty($conditions)) {
                $query .= "WHERE " . implode(' = ? AND ', array_keys($conditions)) . ' = ?';
                $params = array_values($conditions);
            }
        } elseif ($conditions !== false) {
            $query .= "WHERE id = :id";
            $params = array('id' => $conditions);
        }

        if ($limit) {
            $query .= " LIMIT $limit";
        }

        return $this->query($query, $params)->fetchAll();
    }
public function selectAll($table, $conditions = false, $select = '*', $limit = null)
    {
        $params = array();
        $query = "SELECT $select FROM " . $this->getTable($table) . ' ';

        if (is_array($conditions)) {
            if (!empty($conditions)) {
                $query .= "WHERE " . implode(' = ? AND ', array_keys($conditions)) . ' = ?';
                $params = array_values($conditions);
            }
        } elseif ($conditions !== false) {
            $query .= "WHERE id = :id";
            $params = array('id' => $conditions);
        }

        if ($limit) {
            $query .= " LIMIT $limit";
        }

        return $this->query($query, $params)->fetchAll();
    }
public function selectAll ( $ table , $ conditions = false , $ select = '*' , $ limit = null ) { $ params = array ( ) ; $ query = "SELECT $select FROM " . $ this -> getTable ( $ table ) . ' ' ; if ( is_array ( $ conditions ) ) { if ( ! empty ( $ conditions ) ) { $ query .= "WHERE " . implode ( ' = ? AND ' , array_keys ( $ conditions ) ) . ' = ?' ; $ params = array_values ( $ conditions ) ; } } elseif ( $ conditions !== false ) { $ query .= "WHERE id = :id" ; $ params = array ( 'id' => $ conditions ) ; } if ( $ limit ) { $ query .= " LIMIT $limit" ; } return $ this -> query ( $ query , $ params ) -> fetchAll ( ) ; }
Executes a SELECT query and return all results

```php
// Find by the "id" key
$db->selectAll('user', 1);

// Find by specified column
$db->selectAll('user', array('username' => 'twin'));

// Find in list
$db->selectAll('user', array('id' => array(1, 2, 3)));
```

@param string $table The name of table
@param bool $conditions The "id" key value or an associative array containing column-value pairs
@param string $select The table columns to select
@param int $limit The row number to retrieve
@return array
Executes a SELECT query and return all results