ok so i am trying to update a MS access database record via odbc and when one of my fields has an apostrophe/single quote in it, the query fails with the following error:
odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression ... SQL state 37000 in SQLExecDirect
my query looks like this:
$title=$_POST['MovieTitle'];
$Year=$_POST['ProdYear'];
$trailerURL=$_POST['Trailer'];
$overview=$_POST['overview'];
$movieID = $_POST['movieID'];
$conn=odbc_connect('MyMovies','','') or die('Could Not Connect to ODBC Database!');
$sql="UPDATE tblTitles
SET nvcLocalTitle = '" . $title . "',
intProductionYear = '$Year',
nvcTrailerUrl = '$trailerURL',
ntxDescription = '" . $overview . "'
WHERE intID = $movieID";
$rs=odbc_exec($conn,$sql);
and the text for the $overview is as follows:
A computer programmer's dream job at a hot Portland-based firm turns nightmarish when he discovers his boss has a secret and ruthless means of dispatching anti-trust problems.
if i remove the ' in programmer's then it works fine.
i checked magic_quotes_gpc and it is on. i even tried applying the addslashes() function and had the same result. any ideas please??