Revision: 39808
Updated Code
at March 29, 2011 08:38 by drifterz28
Updated Code
<? // the 2 post items that we need for tax. $zip = $_POST['Ship-Zip']; $total = $_POST['Taxable-Total']; // connect to your mysql db, with yahoo your localhost is mysql mysql_connect("mysql", "username", "password") or die(mysql_error()); mysql_select_db("tax_rates") or die(mysql_error()); $result = mysql_query("SELECT * FROM `zip_codes` WHERE `zipcode` LIKE CONVERT( _utf8 '$zip' USING latin1 )") or die(mysql_error()); $num_rows = mysql_num_rows($result); // this checks if a zip code is returned, if no then no tax is charged if($num_rows != "0"){ while($row = mysql_fetch_array( $result )) { $percent = $row['taxrate']; } $to = ($percent/100)*$total; }else { $to = "0"; } //needs the 200 ok header for the cart to see it. header("HTTP/1.0 200 OK"); header("Tax-Charge: $to"); ?>
Revision: 39807
Updated Code
at January 23, 2011 17:36 by drifterz28
Updated Code
<? // the 2 post items that we need for tax. $zip = $_POST['Ship-Zip']; $total = $_POST['Taxable-Total']; // connect to you mysql db, with yahoo your localhost is mysql mysql_connect("mysql", "username", "password") or die(mysql_error()); mysql_select_db("tax_rates") or die(mysql_error()); $result = mysql_query("SELECT * FROM `zip_codes` WHERE `zipcode` LIKE CONVERT( _utf8 '$zip' USING latin1 )") or die(mysql_error()); $num_rows = mysql_num_rows($result); // this checks if a zip code is returned, if no then no tax is charged if($num_rows != "0"){ while($row = mysql_fetch_array( $result )) { $percent = $row['taxrate']; } $to = ($percent/100)*$total; }else { $to = "0"; } //needs the 200 ok header for the cart to see it. header("HTTP/1.0 200 OK"); header("Tax-Charge: $to"); ?>
Revision: 39806
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 21, 2011 06:53 by drifterz28
Initial Code
<? // the 2 post items that we need for tax. $zip = $_POST['Ship-Zip']; $total = $_POST['Taxable-Total']; // connect to you mysql db, with yahoo your localhost is mysql mysql_connect("mysql", "username", "password") or die(mysql_error()); mysql_select_db("tax_rates") or die(mysql_error()); $result = mysql_query("SELECT * FROM `zip_codes` WHERE `zipcode` LIKE CONVERT( _utf8 '$zip' USING latin1 )") or die(mysql_error()); $num_rows = mysql_num_rows($result); // this checks if a zip code is returned, if no then no tax is charged if($num_rows != "0"){ while($row = mysql_fetch_array( $result )) { $percent = $row['taxrate']; } $to = $total/$percent; }else { $to = "0"; } //needs the 200 ok header for the cart to see it. header("HTTP/1.0 200 OK"); header("Tax-Charge: $to"); ?>
Initial URL
Initial Description
Initial Title
Real Time Tax rates
Initial Tags
mysql, php
Initial Language
PHP