petercascio Posted March 10, 2006 Posted March 10, 2006 I've modded our store so it sends out two different emails, one to the customer and a quite diferent one to the store owner. I've also added a tax by county contribution which I've modded for NY state. Now I need to put some extra info into the email to the store owner but as a mysql newbie I got totally lost. My variable $county_id comes from 'zone_id' in table 'zones'. Using $county_id I need to get the tax reporting code 'nytax_code' and tax rate 'tax_rate' which are in table 'tax_rates' and stick them into the email. I won't even post here what I put together on a test page because I'm sure I'd get laughed out of the room! Peter
petercascio Posted March 11, 2006 Author Posted March 11, 2006 After phutzing around for quite some time I came up with the following kludge -- PLEASE, no laughing! It works, but any suggestions on improving it? // pull out the county from 'state' which is in the format "NY (My County)" $my_variable_county = $order->billing['state']; $query = "SELECT * FROM zones WHERE zone_name = '$my_variable_county'"; $answer = mysql_query($query); $row = mysql_fetch_array( $answer ); $my_variable_zone=$row['zone_id']; //extract the zone's ID from the answer // now use zone_id to locate the state's four digit tax ID and the tax rate for this county $query = "SELECT * FROM tax_rates WHERE tax_zone_id = '$my_variable_zone'"; $answer = mysql_query($query); $row = mysql_fetch_array( $answer ); $my_variable_district=$row['tax_dist']; //extract the state's four digit tax ID from the answer $my_variable_rate=$row['tax_rate']; //extract the tax rate for this county from the answer
Recommended Posts
Archived
This topic is now archived and is closed to further replies.