I am very close to having a MOM export capability with OSC. However, I am having trouble with a query in my exporter, and I hope someone can help!
Basically, I want to get the two-letter state abbreviation from the order, rather than the full state name.
So, this is my query:
($Billing_State is the Name of the state taken from the order table: e.g. "Alabama" or "New York")
$State_Abbrev = tep_db_query("
SELECT zones.zone_code
FROM zones
WHERE zones.zone_name = ". $Billing_State);
Remote SQL queries to my OSC database work fine with this syntax
(with quotation marks around a State Name).
However, OSC seems to choke, giving me this:
"1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'York' at line 4"
SELECT zones.zone_code FROM zones WHERE zones.zone_name = New York"
Two questions come to mind:
1) How do I manage to put quotation marks around the "New York" in the query? My remote query has quotation marks around it, and works.
2) Could it be the "New" in New York that is causing the choke?
3) Am I missing something terrible?
Any and all help appreciated!
--ACB