karimali831 Posted May 31, 2010 Share Posted May 31, 2010 Hi, I have a problem with this query: $gameacc = safe_query("SELECT gameaccID FROM ".PREFIX."cups WHERE ID = '$cupID'"); $ds=mysql_fetch_array($gameacc); $mem = safe_query("SELECT userID FROM ".PREFIX."cup_clan_members WHERE clanID = '$clanID'"); while($db = mysql_fetch_array($mem)) { $result = safe_query("SELECT value FROM ".PREFIX."user_gameacc WHERE userID = '".$db['userID']."' && type = '".$ds['gameaccID']."'"); $anz_mem = mysql_num_rows($result); echo '<br>ent = '.$anz_mem.''; The result of $anz_mem is like this: ent = 1 ent = 2 ent = 3 so this means 1/2/3 rows in the loop? I would like this all added together, 1/2/3 = 6 so $anz_mem = 6 and not ent = 1 ent = 2 ent = 3 anyone understand? Hope so Thanks for help Quote Link to comment Share on other sites More sharing options...
ashwood Posted May 31, 2010 Share Posted May 31, 2010 sumert like echo $val1 + $val2 + $val3 im not sure how maths works in php Quote Link to comment Share on other sites More sharing options...
Zane Posted May 31, 2010 Share Posted May 31, 2010 echo $anz_num outside of the while loops... but add them together inside it. while (mysql_fetch_array()) { $result = mysql_query (....) $anz_num += mysql_num_rows($result); //Add it here / Sum it... whatever } echo $anz_num; // Echo is here! Quote Link to comment Share on other sites More sharing options...
karimali831 Posted May 31, 2010 Author Share Posted May 31, 2010 Perfect, that worked. Thanks very much 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.