SelectQuery Class
Represents a SELECT SQL statement
$users = $db->select('first_name')
->from('users')
->where('user_id=1')
->results();
Constructor
Item Index
Methods
Methods
__toString
()
String
Represent the query as a SQL statement
Returns:
The query in SQL string form
from
-
args
Select from the tables
Parameters:
Returns:
Instance of this query
length
-
[cache=false]
Get the number of rows
Parameters:
-
[cache=false]
Boolean optionalIf we should cache the result
Returns:
The number of rows by selection
limit
-
lengthOrIndex
-
[duration=null]
The limit for query
Parameters:
-
lengthOrIndex
IntEither the single limit number or index, duration
-
[duration=null]
Int optionalHow many rows to fetch
Returns:
The instance of this query
orderBy
-
field
-
[order='asc']
How to order the results by
Parameters:
Returns:
The instance of this query
prepare
-
value
Take an existing value we're about to input and escape it, if needed
Parameters:
-
value
StringA statement or sql property to evaluate
Returns:
A string of an escaped, prepared SQL property
prepareField
-
field
Take an existing field name we're about to input and
Parameters:
-
field
StringThe name of a field
Returns:
A string of an escaped, prepared SQL field name
results
-
[cache=false]
Select all of the results
Parameters:
-
[cache=false]
Boolean optionalIf we should cache the result
Returns:
Get array of row items
row
-
[cache=false]
Get the row of data
Parameters:
-
[cache=false]
Boolean optionalIf we should cache the result
Returns:
The array of values for this row