session? Query and VAT
Posted: Thu Jan 13, 2011 12:24 pm
My brain no longer works, It has packed up and left for the day. o.0
In a table called ride there is a price 2.50. I need this result to calculate VAT for one seat and then two seats.
here is what I have so far =)
query:
her is the VAT function:
I know hat the VAT function is messy, there must be an easier way to do this. could someone please help me combine the query and VAT function to give two variables 1 for 1 seat and 1 for 2 seats.
also the query I have doesn't need to have the price displayed, the 2.50 is just a base price =) I just had an echo to see if it was working first.
=)
any help would be fantastic.
In a table called ride there is a price 2.50. I need this result to calculate VAT for one seat and then two seats.
here is what I have so far =)
query:
Code: Select all
$query =mysql_query("SELECT price FROM ride WHERE rideID ='1' LIMIT 1");
while ($row=mysql_fetch_array($query))
{
echo $row['price'];
echo "<br>";
}
Code: Select all
$seatPrice2=($price*2);
$seatPrice1=($price*1);
$vat1=17.5;
$priceXvat=$price;
function vat($vat, $priceXvat)
{
return sprintf("%01.2f", ($vat*$priceXvat/ 100));
}
$vatprice1 = vat(17.5, 2.50);
$vatprice2 = vat(17.5, 2.50);
$total2=($vatprice2*2);
$SSendPrice2= ($total2+$seatPrice2);
$total1=($vatprice1*1);
$SSendPrice1= ($total1+$seatPrice1);
also the query I have doesn't need to have the price displayed, the 2.50 is just a base price =) I just had an echo to see if it was working first.
=)
any help would be fantastic.