note 95083 deleted from function.sqlite-escape-string by cmb
| From: | cmb@php.net | Date: | Mon, 02 Nov 2020 14:59:01 +0000 |
| Subject: | note 95083 deleted from function.sqlite-escape-string by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215728@lists.php.net to get a copy of this message | ||
Note Submitter: carlo_greco at live dot it
----
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")
?>