这些是 table column 上的情况post_attending,post_attending可能是:5or 5,6,7or 6,7,5or or 6,5,7or ''or more string comma separator and 5 on this or not。我应该如何删除,在 PDO 查询中使用的“5”和“可能”?
我试过这个:
$q= "UPDATE table SET post_attending = SUBSTR(REPLACE(CONCAT(',', post_attending, ','), ? , ','), 2, LENGTH(REPLACE(CONCAT(',', post_attending, ','), ? , ',')) - 2) WHERE id = x "
$sql->execute(array(5,5,x));
,但是当最后有一个 5 或 5 时,它给我留下了一个。
我读过这个也TRIM(BOTH ',' FROM REPLACE(wishes, '(,)? :var (,)?', ''))没有真正弄清楚正确的语法。