- ⌂ repo
- Methods
- Constructor
- execute()
- get()
- get_content_type()
- get_first()
- get_object()
- get_object_by_id()
- get_object_by_oid()
- get_object_by_doid()
- get_object_by_uuid()
- get_objects_by_id()
- get_objects_by_oid()
- get_objects_by_doid()
- get_objects_by_uuid()
- get_root()
- get_row()
- get_rows()
- get_system_property()
- log_alert()
- log_critical()
- log_to_file()
- log_to_html()
- new_collection()
- new_object()
- peek_user()
- pop_user()
- push_super_user()
- push_user()
- query()
- supports_dimensions()
- switch_user()
- uninit()
- with()
repo::get_rows()
Execute a query array, query object or cQL string and return a
of matching objects.row set
Prototype
row_set get_rows(mixed $query, array $options = [])
Parameters
- query - cPath string, cQL string, Query Object, cQL Array
- options
- bind - Array of variables to bind to the query. If the binding is a question mark (ie. ?), the array index is an index to the question mark (first question mark is represented by index zero, etc.). If the binding is a named binding (ie. :Name), the array index is the binding name.
Return
A
of associative arrays that match the query.row set
Example
$contacts = $repo->get_rows("SELECT Name, Phone FROM Contact WHERE Name='John'");
foreach($contacts as $contact) {
echo($contact['Name'] . " - " . $contact['Phone'] . "\n");
}
Binding Example
$name = 'John';
$contacts = $repo->get_rows("SELECT Name, Phone FROM Contact WHERE Name=?", ['bind'=>[$name]]);
foreach($contacts as $contact) {
echo($contact['Name'] . " - " . $contact['Phone'] . "\n");
}
Binding Example
$name = 'John';
$contacts = $repo->get_rows("SELECT Name, Phone FROM Contact WHERE Name=:Name", ['bind'=>[$name]]);
foreach($contacts as $contact) {
echo($contact['Name'] . " - " . $contact['Phone'] . "\n");
}