gpt4 book ai didi

php - Apache SSL 错误尝试使用 pg_query_params()

转载 作者:行者123 更新时间:2023-11-29 13:55:38 26 4
gpt4 key购买 nike

在 PHP 5.3.29 中尝试使用 pg_query_params() 向我的远程 PostgreSQL 9.3 数据库发出请求时,我有时会从 Apache 收到一个模糊的错误:

<br /> <b>Warning</b>: pg_query_params() [<a href='function.pg-query-params'>function.pg-query-params</a>]: Query failed: SSL error: block type is not 01 in <b>/index.php</b> on line <b>171</b><br />

它只会间歇性地发生——查询通常会成功——所以我知道这不是我的代码的语法或其他问题。但是,为了完整起见,这里是相关的 PHP 和 SQL:

...
$query = <<<POWER_TEACHERS
WITH teachers AS (
SELECT ca.started_by_id, sus.email, sus.zip_code
FROM common_activityinstance ca, socrative_users_socrativeuser sus
WHERE ca.end_time >= $1::date
AND ca.end_time < $2::date + 1
AND ca.started_by_id = sus.id
AND sus.zip_code IS NOT NULL
GROUP BY ca.started_by_id, sus.email, sus.zip_code
HAVING COUNT(*) >= 3
ORDER BY random()
LIMIT 250
), activities AS (
SELECT ca.id, t.email, t.zip_code
FROM common_activityinstance ca, teachers t
WHERE ca.end_time >= $1::date
AND ca.end_time < $2::date + 1
AND ca.started_by_id = t.started_by_id
)
SELECT zip_code, email
FROM (
SELECT DISTINCT ON (s.user_uuid) s.user_uuid, a.id, a.email, a.zip_code
FROM students_studentresponse s, activities a
WHERE s.activity_instance_id = a.id
ORDER BY s.user_uuid
) sub
GROUP BY email, zip_code
HAVING COUNT(*) >= 3
ORDER BY zip_code;
POWER_TEACHERS;
$result = pg_query_params($con, $query, array($lastWeek, $today)); // error here
...

是什么导致了这种奇怪的行为?

最佳答案

如果这对其他人有帮助,我通过放弃 PHP、切换到 Node.js 并使用优秀的 pg-native 来“解决”这个问题。模块。我从上面的查询,完全没有改变,执行没有任何问题。

关于php - Apache SSL 错误尝试使用 pg_query_params(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32662060/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com