Unanswered: Creating UPDATE statement when values contain single quote or double quote
Hello. I am trying to figure out the correct syntax for an SQL statement to UPDATE a table with a value that contains a quote or apostrophe. I am pasting a snippet below. I have included in my code substitute reg expressions to escape quotes and apostrophes. I get a software error whether or not I include the escapes. The error: Syntax error (missing operator) in query expression
Thank you for looking.
$dbh = DBI->connect('dbi:ODBC:driver=microsoft access driver (*.mdb);dbq=\\\\cessna3\\dept425\\YellowFlag\\atdf lags.mdb')
or die "Can't open the database." ;
Show what $SQL evaluates to right before you execute it:
$SQL = qq(UPDATE Flags SET Condition = '$updatecondition',SkillCoach = '$updateskillcoach',Notes = '$updatenotes' WHERE ID = $recordid);
I don't know how to do that. I think I got it working anyway. I ended up escaping the apostrophe with another apostrophe and I was incorrect in thinking that a double quote needs escaped. So it is updating correctly for now. Thanks for looking.