I have a table (cod, nom) but the nom field has (') and (") and blank spaces. I want to clean all that table using this code:
<?php
class ConexionDB extends PDO {
  public function __construct () {
  try {
      parent:: __construct('mysql:host=localhost;dbname=xprueba;charset=utf8', 'root','key');
      parent:: setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      } catch (Exception $ex) { die ('Database is not exist');  }  }
  function __destruct(){
  }
}
$BD = new ConexionDB();
$replace_these = ['"','\''];
$replace_with = ['',''];
$sql = "UPDATE xxx SET nom = :nom";
$sth = $BD->prepare($sql);
$nom = trim(str_replace($replace_these, $replace_with, :nom));
$sth->bindParam(':nom', $nom);
$sth->execute();
I get this message: Parse error: syntax error, unexpected ':' in C\:limpia4.php on line 19
Is when I use trim()
Can somebody help me?
 
    