As they say in the comments, when writing that query (as a string) you must escape the% bar_counds of% again.
This is your query as a string in php:
$consulta = "... columna= REPLACE (columna,'\\SERVER','D:xampp\htdocs') ..."
As in the php strings, the backslash is used to escape, the real query that arrives in the database is:
\
But in addition, the REPLACE function can receive strings / literals as parameters, so it also uses the backslashes to escape quotes and other backstops.
So, this SQL:
... columna= REPLACE (columna,'\SERVER','D:xampp\htdocs') ...
It really means: Replace in "column", this: "\ SERVER" with "D: xampphtdocs"
(In the second parameter the backslash disappears because there is only one and within the string there should be 2 because the backstops must escape)
So if the column is worth ... columna= REPLACE (columna,'\SERVER','D:xampp\htdocs') ...
and replace \SERVER
with \SERVER
, we have what you get: D:xampphtdocs
To solve this, try escaping the backslashes again:
$miconsulta = "
UPDATE basedatos.tabla
SET columna= REPLACE (columna,'\\\\SERVER','D:xampp\\htdocs')
WHERE id=1
";