note 50434 deleted from function.odbc-exec by googleguy

From: Date: Tue, 22 Oct 2013 10:15:37 +0000
Subject: note 50434 deleted from function.odbc-exec by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-196949@lists.php.net to get a copy of this message
Note Submitter: Tom Cully <mail at tomcully dot com> ---- 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; }

« previous php.notes (#196949) next »