I recently wrote a database class that uses PDO to connect to SQL Server databases, as well as to MySQL databases. It always replaced the question marks perfectly when used in MySQL databases, but for the SQL Server database I had to create a job that basically replaces the question marks manually. Here is the code for this.
if($this->getPDODriver() == 'odbc' && !empty($values_a) && substr_count($query_s, "?") > 0) {
$query_s = preg_replace(array_fill(0, substr_count($query_s, "?"), '/\?/'), $values_a, $query_s, 1);
$values_a = NULL;
}
Now I understand that this completely defeats the purpose of question marks and PDO, but it works fine for me. What I would like to do now, it turned out why the question marks are not replaced in the first place and delete this workaround.
If I have a select statement like the following
SELECT * FROM database WHERE value = ?
, , .
, MySQL, . , - .