jsk1gcc Posted January 13, 2011 Share Posted January 13, 2011 Okay to start with, I apologise for the messy code. I have a table called ride with a column called price(it is 2.50). I need to query the table and then add VAT to it. the query I have at the moment is $query =mysql_query("SELECT price FROM ride WHERE rideID ='1' LIMIT 1"); while ($row=mysql_fetch_array($query)) { echo $row['price']; echo "<br>"; } The result of the echo is 2.50 The VAT function is $seatPrice2=($price*2); $seatPrice1=($price*1); $vat1=17.5; function vat($vat, $price) { return sprintf("%01.2f", ($vat*$price/ 100)); } $vatprice1 = vat(17.5, 2.50); $vatprice2 = vat(17.5, 2.50); $total2=($vatprice2*2); $endPrice2= ($total2+$seatPrice2); $total1=($vatprice1*1); $endPrice1= ($total1+$seatPrice1); echo"$endPrice1"; echo "<br>"; echo "$endPrice2"; endPrice1 is the value of one seat including VAT and endPrice2 is the value of 2 seats inc VAT. I have used echo during development, the endPrice1 and 2 could really do with being in a session, as they won't be posted back to the user on the same page and I would like to use them in an email script. [also to note, the user can choose one seat or two seats] I would really appreciate some help in turning what I have into a result that I can place into a session. Thanks =) Link to comment https://forums.phpfreaks.com/topic/224350-sessions-vat-and-query/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.