@ 2023-04-17T07:05:44Z <?php
$query = 'UPDATE `list?` set `item`=?,`type`=?
WHERE ( "ty?pe?"<> \'Are yo?\' `id` = ?);';
$params = array(
'item' => '1',
'type' => 'Are you o\'k?',
'id' => '2'
);
function substitute_params($query, $params) {
$prep_params = str_replace(array("'","?"),array("''","\\?"),$params);
$query = array_reduce($prep_params, function ($interm, $param) {
return preg_replace('/^([^"\'`]*?(?:(?:`[^`]*?`[^"\'`]*?)*?(?:"[^"]*?"[^"\'`]*?)*?(?:\'[^\']*?\'[^\'"`]*?)*?)*?)(?<!\\\\)\\?/m',
'${1}'.(is_numeric($param) ? $param : '\'' . $param . '\''),
$interm,
1);
}, $query);
return "-- Not to be used as a query to database. For demonstration purposes only!\n"
.str_replace("\\?", "?", $query);
}
echo substitute_params($query, $params);
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.0.1 - 8.0.30 , 8.1.0 - 8.1.33 , 8.2.0 - 8.2.29 , 8.3.0 - 8.3.26 , 8.4.1 - 8.4.13 -- Not to be used as a query to database. For demonstration purposes only!
UPDATE `list?` set `item`=1,`type`='Are you o''k?'
WHERE ( "ty?pe?"<> 'Are yo?' `id` = 2); preferences:dark mode live preview ace vim emacs key bindings
108.68 ms | 407 KiB | 5 Q