You can query and order by any number of fields (although the more fields you search and order on, the more the work has to be done by the DB, so performance can suffer on large data sets).
So for your example you could do something like this:
$_sc = array(
"search" => array(
"audio_genre = pop"
),
"order_by" => array(
"audio_stream_counts" => "numerical_desc"
),
"pagebreak" => 12,
"page" => 1
);
$_rt = jrCore_db_search_items('jrAudio', $_sc);
So this query would return all songs that had the "audio_genre" key set to "pop", and it would order them by the value of the "audio_stream_counts" value, numerically descending.
Here's a more complicated example to show some of the things you can do:
$_sc = array(
"search" => array(
"audio_genre in pop,rock,dance",
"audio_title like a% || audio_title like b%"
),
"order_by" => array(
"audio_stream_counts" => "numerical_desc",
"audio_title" => "desc"
),
"pagebreak" => 12,
"page" => 1
);
$_rt = jrCore_db_search_items('jrAudio', $_sc);
This example would find all audio entries with their audio_genre set to either "pop", "rock" or "dance", and their audio_title would start with either an "a" or a "b". It would then order them by the number of plays descending, and for entries that had the same number of plays it would order those by their title from z -> a.
Let me know if that helps.
Thanks!
--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net