note 7792 deleted from ref.odbc by sniper
| From: | sniper@php.net | Date: | Tue, 04 Nov 2003 00:36:41 +0000 |
| Subject: | note 7792 deleted from ref.odbc by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59748@lists.php.net to get a copy of this message | ||
Note Submitter: esk525@hotmail.com
----
For those having trouble with apostrophies in their ODBC queries: If the database you are
connecting to supports CHAR(39), which prints the character associated with this ASCII number, or
something like it, try this:
$myInput = ereg_replace("'","'+CHAR(39)+'",$myInput);
$query = "Select * From Table Where (Field='$myInput')";
$connection = odbc_connect("mydb","myuserid","mypass");
$result = odbc($connection,$query);
p.s. Don't forget the 's around the variable in the query line... good luck