Jump to content

Count sql_num_rows


karimali831

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/203417-count-sql_num_rows/
Share on other sites

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!

Link to comment
https://forums.phpfreaks.com/topic/203417-count-sql_num_rows/#findComment-1065652
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.