【发布时间】:2011-01-14 17:20:18
【问题描述】:
我正在使用pg_prepare 在 PHP 中准备我的 SQL 语句。当我尝试使用需要为NULL 的值来pg_execute 时,函数失败。同样,使用SQL关键字now()时也会失败。
代码:
pg_prepare($connection, "insert_autosave", 'INSERT INTO autosave (category, editor, session_id, content, timeout, as_hook) VALUES ($1, $2, $3, $4, $5, $6) RETURNING id');
$result = pg_execute($connection, "insert_autosave", array($category, $editor, $sid, $content, ($sto == "timeout" ? 'TRUE' : 'FALSE'), (is_numeric($asid) ? $asid : 'NULL')));
错误:
[pg_execute]:查询失败:错误:整数输入语法无效:第 49 行的 actions.php 中的“NULL”
做一个普通的pg_query 工作。关于如何解决这个问题的任何想法?
【问题讨论】:
标签: php postgresql pdo