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