acctman Posted September 10, 2007 Share Posted September 10, 2007 ok this is my third post my first two posting were a little confusing. Please let me know if each query is correct $userid is defined //count all entries for $userid, so if $userid is found in 103 ref_id rows out 103 $en['totalref'] = mysql_num_rows(mysql_query("SELECT `ref_id` FROM `rate_referrals` WHERE `ref_userid` = '{$userid}'")); //using $userid if it = ref_userid then grab each rows ref_mem entry, then go to rate_members table and for each ref_mem value look up the members 'm_id' field in rate_members table if = then go to m_type field to see if the value there is 1 (1=male), if 1 then count that row... Tally up all referred members that are Males. $en['totalm'] = mysql_num_rows(mysql_query("SELECT `ref_mem` FROM `rate_referrals` WHERE `ref_userid` = '{$userid}'")); need more coding to access rate_members //add up all the points in field ref_points for $userid $en['totalpts'] = mysql_result(mysql_query("SELECT sum(ref_points) as totalpoints FROM `rate_referrals` WHERE `ref_userid` = '{$userid}' ")0,'totalpoints'); //output the total amount of referred users for $userid that have a ref_status of 0 or 1 $en['totalpend'] = mysql_result(mysql_query("SELECT COUNT(*) `Count` FROM `rate_referrals` WHERE `ref_userid` = '{$userid}' and ( `ref_status` = '0' or `ref_status` = '1' ) GROUP BY `ref_userid` ")); there is another while/loop section that I will post later, just so i won't confuse anyone. any help with fixing those queries would be appericated. Quote Link to comment Share on other sites More sharing options...
acctman Posted September 11, 2007 Author Share Posted September 11, 2007 anyone can help? i've been trying to get this query coded correctly for 5 days now Quote Link to comment Share on other sites More sharing options...
fenway Posted September 11, 2007 Share Posted September 11, 2007 Correct how? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.