0

I have the following code:

$stmt = $conn->prepare("INSERT festiwal_zdjecia (uuid, url, rok) VALUES(?, ?, ?) "
            ."ON DUPLICATE KEY UPDATE rok = ?;");
$stmt->execute(array($uuid,$z,$rok,$rok));

The $z variable is equal to 'xxx|yyy.jpg'. After running the script, in the db I can see: url = 'xxx'.

kade99
  • 37
  • 6

1 Answers1

1

Use Bind param to escape the pipe PDO::PARAM_STR Refer to the following post Use bound parameter multiple times

  • Having several `?` placeholders does not really count as using bound parameters multiple times (that's a problem that affects named `:foo` placeholders) and I always thought that `PDO::PARAM_STR` is the default in most drivers. I honestly can't figure out what this answer has to do with the question, nor why it's been accepted by the OP :-? – Álvaro González Oct 31 '18 at 09:52
  • This answer was accepted because it worked (although I agree it's weird) – kade99 May 06 '20 at 04:12