note 95083 added to function.sqlite-escape-string
| From: | carlo_greco at live dot it | Date: | Sat, 12 Dec 2009 17:06:05 +0000 |
| Subject: | note 95083 added to function.sqlite-escape-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163882@lists.php.net to get a copy of this message | ||
You can try this (it works with strings and arrays):
<?php
// oop
class sqlite extends SQLiteDatabase {
public function escape($data) {
if(is_array($data))
return array_map("sqlite_escape_string", $data);
return sqlite_escape_string($data);
}
}
$db = new sqlite("dbname");
$values = array("hell'o", "he'y");
$values = $db->escape($values); // returns array("hell''o",
"hey''y")
// procedural
function sqlite_myescape($data) {
if(is_array($data))
return array_map("sqlite_escape_string", $data);
return sqlite_escape_string($data);
}
$values = array("hell'o", "he'y");
$values = sqlite_myescape($values); // returns array("hell''o",
"hey''y")
?>
----
Server IP: 69.147.83.197
Probable Submitter: 93.43.213.23
----
Manual Page -- http://www.php.net/manual/en/function.sqlite-escape-string.php
Edit -- https://master.php.net/note/edit/95083
Del: integrated -- https://master.php.net/note/delete/95083/integrated
Del: useless -- https://master.php.net/note/delete/95083/useless
Del: bad code -- https://master.php.net/note/delete/95083/bad+code
Del: spam -- https://master.php.net/note/delete/95083/spam
Del: non-english -- https://master.php.net/note/delete/95083/non-english
Del: in docs -- https://master.php.net/note/delete/95083/in+docs
Del: other reasons-- https://master.php.net/note/delete/95083
Reject -- https://master.php.net/note/reject/95083
Search -- https://master.php.net/manage/user-notes.php