mysql - mysql将字符串转换为int不起作用(使用pdo)
问题描述
我想先将 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;
解决方案
推荐阅读
- r - 将日期转换为特定格式,如月份、日期、年份
- drupal - 内容中的标题字段消失了
- c# - C# 将项目添加到列表
- java - 如何使用 JSSE 实现在 tomcat 8.5.5 中启用 TLSv1.3
- c# - C# .net 核心:具有相同 ID 的隐藏输入的多个 ajax 表单
- perl - goto 语句以及 if else 条件的问题
- python-requests - 当两者都需要不同的客户端证书时,如何使用 Python 请求通过代理连接到服务器
- docker - Docker Swarm 是否保持节点之间的数据同步?
- java - Appium iOS:每次测试前退出应用
- javascript - 写入文件 RNFetchBlob 覆盖文件