select

This is simplified version of select query

Arguments
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 : mysqli_result | bool

Static or normal : Static

Examples :

/** Select all user data */
mysql::select('users', '*', ['id' => 123456789], 1);
/** Select user step and value data */
mysql::select('users', ['step', 'value'], ['id' => 123456789], 1);
/** Select top 10 user based on coin value */
mysql::select('users', ['id', 'coin'], count: 10, order_by: ['coin' => 'desc']);
/** Skip 10 user and than select 10 user */
mysql::select('users', 'id', count: 10, offset: 10);
/** select users which have more than 10 coins */
mysql::select('users', '*', ['coin' => '> 10']);