The 1st one didn't work, but the 2nd one did work. Fantastic! Thanks alot, you saved me from frustrations. Quoting "John W. Holmes" <holmes072000@charter.net>: > > I'm having problem querying a table with a field value containing an > > appostropy, please help. Using ODBC to connect MSAcess database. > > > > $mQuery = "CustomerID='$mCust'"; > > $mCur2 = odbc_do( $mCnx, "select Login from Emails where $mQuery" > ); > > > > When it hits "O'Donald, James", I get error in odbc_exec(). I tried > > variations of $mQuery, including: > > > > $mQuery = addslashes( $mQuery ); > > You don't want to use addslashes() on $mQuery, you want to use it on the > data you're inserting between the quotes, i.e. $mCust. > > $mQuery = "CustomerID='" . addslashes($mCust) . "'"; > > If that still causes an error, your database may require quotes to be > escaped with another quote, instead of a backslash. In that case, you > can create a function like this > > function addslashes2($data) > { return str_replace("'","''",$data); } > > Hope that helps. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > > ------------------------------------------------- This mail sent through ISOT. To find out more about ISOT, visit http://isot.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php