MYSQL insert 单引号问题

理想2017 2009-04-25 04:11:15
我想把sql语句作为个字段存储在mysql 数据库中,可是insert 的时候出现问题

select * from person where person_jobwill in("互联网开发及应用"), person_jobarea in(''青海-''), order by person_id descYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sql,company_id)values('网络编程',''select * from person where person_jobwill in(' at line 1
其实就是在 in ('','') 的时候出错
因为我的sql字段是varchar 类型,所以
我的语句这样写 "insert into company_search(sql)values('".$sql."')"
请问这个问题应该怎样解决呢
...全文
535 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
理想2017 2009-04-25
  • 打赏
  • 举报
回复
问题已经解决,其实是我sql语句的最后那个字段多了个逗号,并且我不应该用sql名字作为字段的名称.
程序猿之殇 2009-04-25
  • 打赏
  • 举报
回复
select * from person where person_jobwill in("互联网开发及应用") and person_jobarea in('\'青海-\'') order by person_id
mlsml 2009-04-25
  • 打赏
  • 举报
回复
select * from person where person_jobwill in("互联网开发及应用"), person_jobarea in(''青海-''),

这里用 , ???????
不是应该用and么。。。。。。。

21,882

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧