Hello,
The code posted below is working fine, displaying each row returned from the query with the right values. However, I want to modify the code so that I can sum the total value of all of the $extended_price values for all of the rows returned.
I have been trying to create a variable that adds the new value to the previous value of the $extended_price variable, but I have not had any success. As always, any suggestions are greatly appreciated.
revez2002
<?php
while($row_psq = mysql_fetch_array($prod_serv_quoted_query)) {
$item_name_str = item_name.$index;
$psq_ID_str = psq_ID.$index;
$units_quoted_str = units_quoted.$index;
$price_quoted_str = price_quoted.$index;
printf("", $extended_price = ($row_psq["units_quoted"] * $row_psq["price_quoted"]));
// Display each record returned by the query as a row
printf("
<tr>
<td width=\"10\"></td>
<td class=\"general_content_02_orange\" height=\"25\" width=\"280\" align=\"left\" valign=\"middle\"><input type=\"hidden\" name=\"%s\" value=\"%s\">%s</td>
<td width=\"110\" align=\"right\" valign=\"middle\"><input class=\"lite_green_02\" type=\"text\" name=\"%s\" value=\"%s\" style=\"width:70px;\"></td>
<td width=\"110\" align=\"right\" valign=\"middle\"><input class=\"lite_green_02\" type=\"text\" name=\"%s\" value=\"%s\" style=\"width:70px;\"></b></td>
<td class=\"general_content_02\" width=\"100\" align=\"right\" valign=\"middle\">$extended_price</td>
<td width=\"40\" align=\"right\" valign=\"middle\"><img border=\"0\" height=\"16\" width=\"17\" align=\"absmiddle\" src=\"content/projects/images/remove_checklist_item_button.jpg\"> </td>
</tr>\n",
$psq_ID_str, $row_psq["psq_ID"],
$row_psq["item_name"],
$units_quoted_str, $row_psq["units_quoted"],
$price_quoted_str, $row_psq["price_quoted"]);
//Increase counter values by 1 for each loop
$index++;
$index_count++;
}
while ($row_wyz = mysql_fetch_array($prod_serv_quoted_query));
// Index counter to track the number of rows
echo "<tr><td height=\"0\" colspan=\"6\">";
echo "<INPUT TYPE=\"hidden\" NAME=\"counter\" VALUE=\"$index_count\">\n";
echo "</td></tr>";
?>