mysql: minor code changes

This commit is contained in:
E. S. 2024-03-09 16:52:57 +00:00
parent 39a6b7f384
commit 96236f66d3

View File

@ -14,7 +14,7 @@ class mysql {
global $config; global $config;
if (!empty($args)) { if (!empty($args)) {
$mark_count = substr_count($sql, '?'); $mark_count = substr_count($sql, '?');
$positions = array(); $positions = [];
$last_pos = -1; $last_pos = -1;
for ($i = 0; $i < $mark_count; $i++) { for ($i = 0; $i < $mark_count; $i++) {
$last_pos = strpos($sql, '?', $last_pos + 1); $last_pos = strpos($sql, '?', $last_pos + 1);
@ -25,7 +25,7 @@ class mysql {
if (is_null($arg_val)) { if (is_null($arg_val)) {
$v = 'NULL'; $v = 'NULL';
} else { } else {
$v = '\''.$this->escape($arg_val) . '\''; $v = '\''.$this->escape($arg_val).'\'';
} }
$sql = substr_replace($sql, $v, $positions[$i], 1); $sql = substr_replace($sql, $v, $positions[$i], 1);
} }