我想先将memberID从字符串转换为int,然后在mysql中执行其他操作,但似乎只有num 3 sql可以工作,我该如何解决? 否则,我有一个问题,为什么我要通过php int类型输入memberID,而mysql将其作为字符串插入?
select hasGivePoint from posts where postID=:postID and json_search(hasGivePoint,'one',(convert(:memberID ,signed))) is not null;
update
posts
set
$pointName=$pointName-1,hasGivePoint=JSON_REMOVE(hasGivePoint,replace(json_search(hasGivePoint,'one',
convert(:memberID ,signed)),'\"',''))
WHERE postID=:postID;
";
update posts set $pointName=$pointName+1,hasGivePoint=JSON_ARRAY_APPEND(hasGivePoint,'$',convert(:memberID ,signed)) where postID=:postID;