Hello Everyone,
I get the following error when I trying to perform an UPDATE.
Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression ''The UV light from a sun bed is similar to UV light from the sun, and cannot penetrate deeper than the skin to harm internal organs. The odor you may notice is what\'s commonly known as the \'after tan\' odor'., SQL state 37000 in SQLExecDirect in C:\WWW Directory\CaribbeanTans.com\admin\tanningFacts\edit.php on line 60
Normally when I experience problems with SQL I have the query string outputed so I am manually insert it within the DB and make adjustments from there. This is the output I receive from PHP.
UPDATE facts SET Myth = 'My friend said she heard that tanning bakes your internal organs. Sometimes I notice a strange smell after I tan. Could this be my organs baking?', Fact = 'The UV light from a sun bed is similar to UV light from the sun, and cannot penetrate deeper than the skin to harm internal organs. The odor you may notice is what\'s commonly known as the \'after tan\' odor, a common occurrence when tanning indoors or outdoors, which is caused by harmless bacteria. California Tan lotions contain the Biosaccharide Complex, which helps prevent after tan odor.' WHERE FactID = 2
When I take this same output and use it within Access (my ODBC DB of choice for this current application) it works just fine.
Here is the code I am using for the UPDATE.
if( isset($_POST['Action']) == "Update" ) {
$FactID = $_POST['FactID'];
$Myth = $_POST['myth'];
$Fact = $_POST['fact'];
$Myth = str_replace('"', "'", $Myth);
$Fact = str_replace('"', "'", $Fact);
if (!get_magic_quotes_gpc()) {
$qMyth = addslashes($Myth);
$qFact = addslashes($Fact);
} else {
$qMyth = $Myth;
$qFact = $Fact;
}
$query = "UPDATE facts SET Myth = '".$qMyth."', Fact = '".$qFact."' WHERE FactID = ".$FactID;
echo $query;
$conn = odbc_connect('****', '****', '****');
odbc_exec($conn, $query);
odbc_close($conn);
}
Any information as to why I am experiencing this error message would be more then appreciated,
Abarak2002