【问题标题】:Mysql: query work on phpmyadmin but generate rollback on php pdoMysql:查询在 phpmyadmin 上工作,但在 php pdo 上生成回滚
【发布时间】:2014-06-08 04:08:40
【问题描述】:

我编写了一个简单的查询,在 phpmyadmin 上工作正常,但如果我在我的 php 脚本中使用 pdo 运行相同的查询,则不会返回错误,并且几秒钟后 db 会执行(我认为)回滚取消我的更新

查询:

UPDATE tab SET whoweare = 'text 888', services = '', logo = '', copertina = '', galleria1 = '', galleria2 = '', galleria3 = '', galleria4 = '', indirizzo = 'input 1', tel_fisso = '', tel_mobile = '', orari = 'input 4', social_www = '', social_tw = '', social_fb = '', social_yt = '', social_lin = '' WHERE users_user='try' 

【问题讨论】:

标签: php mysql sql pdo phpmyadmin


【解决方案1】:

您在查询中遗漏了一个空格,试试这个

UPDATE tab SET whoweare = 'text 888', services = '', logo = '', copertina = '', galleria1 = '', galleria2 = '', galleria3 = '', galleria4 = '', indirizzo = 'input 1', tel_fisso = '', tel_mobile = '', orari = 'input 4', social_www = '', social_tw = '', social_fb = '', social_yt = '', social_lin = '' WHERE users_user='try'

【讨论】:

  • 空格只是我的复制粘贴错误,抱歉。脚本在 where 之前有正确的空间
  • 那你应该提供更多的代码,查询好像没问题
【解决方案2】:

检查您的数据库连接实际上是否已成功打开,以及您连接到数据库的用户是否有权更新该表。

【讨论】:

  • 哇,谁会在打开数据库连接后检查错误的答案投反对票?
猜你喜欢
  • 2013-03-29
  • 2014-07-21
  • 2013-03-14
  • 2018-06-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-17
  • 2018-07-19
相关资源
最近更新 更多