Gdn_SQLDriver::getWhereLike PHP Method

getWhereLike() public method

Builds the select statement and runs the query, returning a result object. Allows a like clause, limit, and offset to be added directly.
public getWhereLike ( string $Table = '', mixed $Like = false, string $OrderFields = '', string $OrderDirection = 'asc', integer $Limit = false, integer $PageNumber = false )
$Table string The table from which to select data. Adds to the $this->_Froms collection.
$Like mixed Adds to the $this->_Wheres collection using $this->Like();
$OrderFields string A string of fields to be ordered.
$OrderDirection string The direction of the sort.
$Limit integer The number of records to limit the query to.
$PageNumber integer The offset where the query results should begin.
    public function getWhereLike($Table = '', $Like = false, $OrderFields = '', $OrderDirection = 'asc', $Limit = false, $PageNumber = false)
    {
        if ($Table != '') {
            $this->mapAliases($Table);
            $this->from($Table);
        }
        if ($Like !== false) {
            $this->like($Like);
        }
        if ($OrderFields != '') {
            $this->orderBy($OrderFields, $OrderDirection);
        }
        if ($Limit !== false) {
            if ($PageNumber == false || $PageNumber < 1) {
                $PageNumber = 1;
            }
            $Offset = ($PageNumber - 1) * $Limit;
            $this->limit($Limit, $Offset);
        }
        $Result = $this->query($this->getSelect());
        return $Result;
    }