Jump to content

im stumped *solved*


xxhopeful

Recommended Posts

i've been working on an equine sim game, and i'm trying to create a script that will pull the horses from the database that are on a certain team. then it will take the statistic (also from the database) and add all their statistic together to make one total score. i am unsure about how to create the script so it adds each individual horses score together, as right now i can only get it to add one of their scores. let me know if you have any ideas! thanks!
Link to comment
Share on other sites

this is the current script i have, but all it does is add ONE of the horses scores together..not all of the horses scores:
[code]
$querryss=mysql_query("SELECT talent,conformation,strength,agility,conformation,endurance,intelligence,speed,trainedin,gender,name,hid from horses where drivingteam='$drivingteamid'")or die(mysql_error());
      $numss=mysql_num_rows($querryss);

if($numss == "0"){
print "No horses on this team.";
exit;
}

      for($i=0; $i<$numss; $i++){

                $hrowedd=mysql_fetch_array($querryss);

$teamscore=$hrowedd[talent]+$hrowedd[conformation]+$hrowedd[strength]+$hrowedd[agility]+$hrowedd[endurance]+$hrowedd[intelligence]+$hrowedd[speed]+$hrowedd[talent]+$hrowedd[conformation]+$hrowedd[strength]+$hrowedd[agility]+$hrowedd[endurance]+$hrowedd[intelligence]+$hrowedd[speed];
}[/code]
Link to comment
Share on other sites

[code]
<?php
$teamscore = 0;
for($i=0; $i<$numss; $i++){

      $hrowedd=mysql_fetch_array($querryss);

      $teamscore += $hrowedd[talent] + hrowedd[conformation] + $hrowedd[strength] + $hrowedd[agility] +
          $hrowedd[endurance] + $hrowedd[intelligence] + $hrowedd[speed] ;
}
echo $teamscore;
?>[/code]
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.