Advertisement
bowenac

ON DUPLICATE KEY UPDATE

Mar 11th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. global $wpdb;
  2. // Inserts values into woocommerce_tax_rates
  3. $wpdb->query("INSERT INTO wp_woocommerce_tax_rates (tax_rate_country, tax_rate_state, tax_rate, tax_rate_name) VALUES ('$country', '$state', '$rate', '$city')
  4. ON DUPLICATE KEY UPDATE tax_rate_id='tax_rate_id'");
  5.  
  6. so I am trying to update zip code tax rates based on a csv file, so I assume I could use the column named tax_rate_id as that stores the actual zip code which would be unique. So I am trying to write the above statement so that if a row exist only update that row, if not insert it as a new row.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement