PHP: Counting entries in a loop and using them in a calculation
<p>I have a loop in PHP as follows:</p>

<pre><code>$getDetails = mssql_query ("SELECT * FROM BasketItems 
WHERE BasketID = '".$_GET['id']."' ");

while ($detailsrow = mssql_fetch_array($getDetails)) {     
  $TotalSetPrice = $detailsrow['FinalPrice'] * $detailsrow['Qty'];
  echo $TotalSetPrice;

  $numberofent = count($detailsrow['FinalPrice']);
  echo "######NUMBER#####: $numberofent";

  $TotalPrice = ?????;

  ######VARIOUS DATA##############
}
</code></pre>

<p>So ok i'm not an expert at PHP by any means, thats the first thing. <code>FinalPrice</code> is the price of an item in the DB that someone has selected. However the customer can have any number of quantity of those items. </p>

<p>So <code>FinalPrice * Qty = TotalSetPrice</code></p>

<p>However the customer may also have different sets of items within the basket. </p>

<p>So I need to calculate <code>TotalSetPrice * (Number of sets of items Within the DB)</code> </p>

<p>SO I googled, and came up with count(), but if I just <code>count($detailsrow)</code> it returns <code>56</code> entries, this is the number of overall pieces of data if that makes sense. I just want to count the dumber of actual data sets. I tried counting <code>finalprice</code> but that just returns <code>1</code>, which isn't correct either. </p>

<p>Can anyone give me some guidence on how you are meant to count the number of entries in an array loop such as this. I hope that makes more sense than I feel it does.</p>
