Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/68752-starting-over-mysql-help-needed/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.