private function buildSelectQuery($select, $from, $where, $groupBy, $orderBy, $limitAndOffset)
    {
        $sql = "
			SELECT
				$select
			FROM
				$from";

        if ($where) {
            $sql .= "
			WHERE
				$where";
        }

        if ($groupBy) {
            $sql .= "
			GROUP BY
				$groupBy";
        }

        if ($orderBy) {
            $sql .= "
			ORDER BY
				$orderBy";
        }

        $sql = $this->appendLimitClauseToQuery($sql, $limitAndOffset);

        return $sql;
    }
private function buildSelectQuery($select, $from, $where, $groupBy, $orderBy, $limitAndOffset)
    {
        $sql = "
			SELECT
				$select
			FROM
				$from";

        if ($where) {
            $sql .= "
			WHERE
				$where";
        }

        if ($groupBy) {
            $sql .= "
			GROUP BY
				$groupBy";
        }

        if ($orderBy) {
            $sql .= "
			ORDER BY
				$orderBy";
        }

        $sql = $this->appendLimitClauseToQuery($sql, $limitAndOffset);

        return $sql;
    }
private function buildSelectQuery ( $ select , $ from , $ where , $ groupBy , $ orderBy , $ limitAndOffset ) { $ sql = "
			SELECT
				$select
			FROM
				$from" ; if ( $ where ) { $ sql .= "
			WHERE
				$where" ; } if ( $ groupBy ) { $ sql .= "
			GROUP BY
				$groupBy" ; } if ( $ orderBy ) { $ sql .= "
			ORDER BY
				$orderBy" ; } $ sql = $ this -> appendLimitClauseToQuery ( $ sql , $ limitAndOffset ) ; return $ sql ; }
Build select query the normal way

@param string $select fieldlist to be selected
@param string $from tablelist to select from
@param string $where where clause
@param string $groupBy group by clause
@param string $orderBy order by clause
@param string|int $limitAndOffset limit by clause eg '5' for Limit 5 Offset 0 or '10, 5' for Limit 5 Offset 10
@return string
Build select query the normal way