簡體   English   中英

相同的查詢不同的結果

[英]Same query different results

我檢查了許多具有相同或相似標題的其他問題,但他們沒有適合我的問題的答案:

// Query:

SELECT *
FROM `rbs`
WHERE `rbs_id` = '92448'

// Simplified output from PHP script

[rbs_id] => 92448
[rbs_status] => 4
[start_date] => 2022-07-22 13:58:36
[end_date] => 2022-07-22 15:12:24

當我在 phpMyAdmin 和 MySQL 命令行上運行完全相同的查詢時,我得到以下結果:

[rbs_id] => 92448
[rbs_status] => 4
[start_date] => 2022-07-22 13:58:36
[end_date] => 2022-12-31 23:59:59

所以 - 運行查詢的三種方式中的兩種將結束日期返回為今年年底,這是我期望看到的,但在 PHP 中,它使用當前日期作為end_date (刷新頁面會更新end_date在結果中,好像某些東西在使用預期日期的查詢之后更新了結果,但是沒有什么可以做到這一點:

$query = $this->db->get($this->table);
print_r($this->db->last_query());
print_r($query->row_array());

I am using Codeigniter 3.1.11 query builder to construct the query, then I output the query that it generated, and copied and pasted that to phpMyAdmin and MySQL command line, so the query is the same in all cases, and it is a very如您所見,簡單的查詢。

我已經重新啟動了 MySQL 服務器,但沒有解決問題。

是的,為了說明這一點 - 我在 PHP 腳本、phpMyAdmin 以及 MySQL 中使用相同的數據庫。

有什么想法會導致結果不同嗎?

這是時區問題,我認為您只需要檢查系統的時區以及腳本即可。 如果兩個時間不同,那就有問題了

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM