This is simplified version of select query
This will return each row as generator
| Name | Type | Description | Required |
|---|---|---|---|
| table | string | Table name | yes |
| columns | array | Your wanted columns, can be string for single column, array for multi column and '*' for all columns | yes |
| where | array | null | Your conditions, Set as key => value pair, see examples | no |
| count | int | Count of the query, Same as limit 5 in sql query | no |
| offset | int | Offset of query, Same as offset 5 in sql qeury | no |
| group_by | int | Your group by, Set as indexed array, value orders is important! | no |
| order_by | int | Your order by , Set as key => mode pair, mode can be asc or desc | no |
Output : generator | bool | null
Static or normal : Static
/** Print all users id */
while($user = mysql::selectEach('users', 'id')) {
print $user['id'];
}/** Print all users id */
foreach(mysql::selectEach('users', 'id') as $user) {
print $user['id'];
}