I have a main table USERS another table DUES. User table contains list of all user of one type & DUES table has the details of those users only who have paid.
I have to list both paid & unpaid users in a CSV file to download.
I have some queries to generate the list of common or uncommon users but the problem is I have to keep them in ascending orders and there I am facing the problem. I don’t know how to loop through so that I mark each user PAID if he exists in DUES table & UNPAID if he doesn’t.
Queries which I have got like –
$all_user_list = db_query("SELECT u.uid,u.name FROM {users} u INNER JOIN {user_roles) ur ON u.uid=ur.uid WHERE ur.rid = 7 ORDER BY name ASC");
$all_paid_user = db_query("SELECT uid,name FROM {dues} WHERE nid = 2001");
Now first array have the list of all users who are suppose to pay and second has list of all those who has paid.
Please somebody suggest me to arrange this in ascending order when I store it in array for CSV..
Please check this. This check the existence of first table data into second table data and if it exists then PAID & if doesn’t then UNPAID.
Store the userids in second array into array called $secondarr.