Hi,
I have created what i think is correct is one mysql_query with multiple counts. Could someone please tell me if i have done it rite ? plus how would i be able to access each count query using PHP so i can display each count query result?
If it's one query i know what to do but as i'm making multiple count queries in one query i don't know how to access each individual total count returned by mysql.
$CountQuery = mysql_query("
SELECT
(SELECT COUNT(*) as `referrer_uid`)
FROM ".constant("TBL_USER_REFERRALS")."
WHERE `referrer_uid` = '$referrer_uid'
AND `status` = '".constant('REFERRAL_STATUS_COMPLETED')."' ,
(SELECT COUNT(*) as `referrer_uid`)
FROM ".constant("TBL_USER_REFERRALS")."
WHERE `referrer_uid` = '$referrer_uid'
AND `status` = '".constant('REFERRAL_STATUS_DECLINED')."',
(SELECT COUNT(*) as `referrer_uid`)
FROM ".constant("TBL_USER_REFERRALS")."
WHERE `referrer_uid` = '$referrer_uid'
AND `status` = '".constant('REFERRAL_STATUS_REFERRED')."'
");
Thanks
PHPLOVER