note 50434 added to function.odbc-exec
| From: | TomCully | Date: | Mon, 28 Feb 2005 16:22:31 +0000 |
| Subject: | note 50434 added to function.odbc-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-85665@lists.php.net to get a copy of this message | ||
MS Access through ODBC doesn't just not like quotes (escape with '' - two single
quotes), it also really hates newlines - chr(10)s - in LONGCHAR fields, and maybe in other BINARY
based fields as well. Leave in a return character - chr(13) - to get a "new line" when
working with LONGCHAR fields in ODBC/MS Access:
Here's a function to do both for you:
function odbc_access_escape_str($str) {
$out="";
for($a=0; $a<strlen($str); $a++) {
if($str[$a]=="'") {
$out.="''";
} else
if($str[$a]!=chr(10)) {
$out.=$str[$a];
}
}
return $out;
}
----
Manual Page -- http://www.php.net/manual/en/function.odbc-exec.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50434
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50434&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50434&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50434&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50434&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50434&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50434&report=yes
Search -- http://master.php.net/manage/user-notes.php