php - 从 pgAdmin 进行查询。无法在 PHP 中正常运行

标签 php postgresql phppgadmin

我正在为我的客户重建应用程序。我编写脚本将数据从旧数据库迁移到新数据库。为了防止列 etiquette_start 中出现空值(旧数据库中发生的情况),我运行

UPDATE items 
SET etiquette_start = 'E' 
WHERE trim(both ' ' from etiquette_start) = '' 
OR etiquette_start is null;

导入数据后。问题是脚本在 pgAdmin III 上运行良好,但无法在 php 脚本上执行。 PHP 语法错误不是这里的问题 - 将其他查询放入上面引用的变量保存查询中会导致成功的数据操作。页面和日志中没有 PHP 错误。

最佳答案

试试这个:

UPDATE items 
SET etiquette_start = 'E' 
WHERE length(trim(both ' ' from etiquette_start)) = 0 
OR etiquette_start is null;

关于php - 从 pgAdmin 进行查询。无法在 PHP 中正常运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15724191/

相关文章:

postgresql - Amazon RDS db.r4.16xlarge 并不比 m3.medium 快多少

linux - 使用 Navicat 通过 SSH 登录 Postgresql - 正确的设置是什么?

javascript - 单击按钮时使用 JQuery 选择 li 中的跨度值

php - 当我在 php 中使用连接表时,mysql_fetch_array 不显示结果

php - Mysql 计数,如果,否则

ruby-on-rails - 将 '01-' 附加到 Rails Controller 上的强参数

heroku - Heroku 数据库的 phpPgAdmin

postgresql - 如何在 Postgres 中使用 phpPgAdmin

PHP 和 Javascript - 记录完整的工作流程