Fishhead
02-01-2010, 07:11 AM
What am I doing wrong. I have a foreach loop that multiplies a variable times a constant and then echo the result. but the result is printing twice.
mysql_select_db($database_connifq, $connifq);
$query_quotapounds = "SELECT * FROM quotapounds";
$quotapounds = mysql_query($query_quotapounds, $connifq) or die(mysql_error());
$row_quotapounds = mysql_fetch_array($quotapounds);
$starting_quota = $row_quotapounds;
foreach($starting_quota as $roll_over){
$roll_over_new = ($roll_over * 1.1);
echo "$counter, $roll_over, $roll_over_new <br>";
}
The output:
0, PN002, 0
0, PN002, 0
0, 0, 0
0, 0, 0
0, 21978, 24175.8
0, 21978, 24175.8
0, 6699, 7368.9
0, 6699, 7368.9
0, 33982, 37380.2
0, 33982, 37380.2
mysql_select_db($database_connifq, $connifq);
$query_quotapounds = "SELECT * FROM quotapounds";
$quotapounds = mysql_query($query_quotapounds, $connifq) or die(mysql_error());
$row_quotapounds = mysql_fetch_array($quotapounds);
$starting_quota = $row_quotapounds;
foreach($starting_quota as $roll_over){
$roll_over_new = ($roll_over * 1.1);
echo "$counter, $roll_over, $roll_over_new <br>";
}
The output:
0, PN002, 0
0, PN002, 0
0, 0, 0
0, 0, 0
0, 21978, 24175.8
0, 21978, 24175.8
0, 6699, 7368.9
0, 6699, 7368.9
0, 33982, 37380.2
0, 33982, 37380.2