PHPlife Posted December 18, 2011 Report Share Posted December 18, 2011 I need to change the way shipping is calculated. Right now the shipping is charged per item as it goes in the cart. I need to make it be on the total dollar amount of items in the cart. For example if I have an item that is $6.00 and something that is $15 - I want to charge shipping on $21. How do i do that? Quote Link to comment Share on other sites More sharing options...
kama1983 Posted January 27, 2012 Report Share Posted January 27, 2012 calculate row 1 + row 2 and add them to final result you can do it for example : <?php $con = mysql_connect("localhost", "peter", "abc123"); if (!$con) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db("test_db",$con); $sql = "SELECT * from Person"; $result = mysql_query($sql,$con); while($row = mysql_fetch_array) { $row1 = $row[0 or name your field]; $row2 = $row[1 or name your field]; echo $row1 + $row2; } mysql_close($con); ?> Quote Link to comment Share on other sites More sharing options...
kama1983 Posted January 27, 2012 Report Share Posted January 27, 2012 calculate row 1 + row 2 and add them to final result you can do it for example : <?php $con = mysql_connect("localhost", "peter", "abc123"); if (!$con) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db("test_db",$con); $sql = "SELECT * from Person"; $result = mysql_query($sql,$con); while($row = mysql_fetch_array) { $row1 = $row[0 or name your field]; $row2 = $row[1 or name your field]; echo $row1 + $row2; } mysql_close($con); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.