I'm using two functions here, get_user_set1
and get_user_set2
.
On my page I have div1
that displays 12 users, and then div2
which also displays 12 users. I have 24 users all together.
What I am trying to do is display all 24 users across the 2 divs so 12 in each. at the moment I have Limit 0
, 12 for the first function and then 12, 24 for the second which displays the first 12 users in the first div and then the second function which displays the next 12 users in the second div.
However, I am trying to figure out how I can make the order in which the 24 users are displayed random without creating a duplicate user and whilst still displaying each of the 24 users and still limiting it to 12. can someone please show me how could I do this?
Thanks.
function 1:
function get_user_set1() {
global $connection;
$query = "SELECT *
FROM ptb_users, ptb_profiles
WHERE ptb_users.account_type = \"User\"
AND ptb_users.account_status = \"Active\"
AND ptb_profiles.user_id = ptb_users.id
AND ptb_users.subscription = \"Free\"
ORDER BY RAND()
LIMIT 0 , 12";
$get_user_set1 = mysql_query($query, $connection);
confirm_query($get_user_set1);
return $get_user_set1;
}
function 2:
function get_user_set2() {
global $connection;
$query = "SELECT *
FROM ptb_users, ptb_profiles
WHERE ptb_users.account_type = \"User\"
AND ptb_users.account_status = \"Active\"
AND ptb_profiles.user_id = ptb_users.id
AND ptb_users.subscription = \"Free\"
ORDER BY RAND()
LIMIT 12 , 24";
$get_user_set2 = mysql_query($query, $connection);
confirm_query($get_user_set2);
return $get_user_set2;
}