I have a table in mysql with some variable:
data price 1 price 2 price 3 price 4
I have a form in a html page with the same field (data;price 1;price 2;price 3;price 4) that client must select (they are option value form)
I use this php formula to calculate an estimate
$query = "SELECT SUM(price1)FROM preventivo Where data>='$_POST[arrivo]' and data <'$_POST[partenza]'";
$dave= mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_assoc($dave)){
foreach($row as $cname => $cvalue){
print "$cvalue\t";}
}
If I repeat this formula for all price (price 1,price2, price3 and price 4) the form doesn't work
Finally I need a fomula that takes into account the possible value of all 4 prices and do the sum among them their
price 1etc. then that is one reason for it to fail. Use undercoresprice_1. Plus, if your table's columns also contain spaces, then either wrap them in backticks, or use underscores for those also. It's hard to say for sure, without seeing the actual codes used.