从数据库中的一个特定表返回结果时遇到问题。
我有两个表:
a) repository_notes
b) repository_noteupdates (this one is giving the problem)
这是一张图片,使用 Navicat 使用简单的 select * 查询显示两个表中都有一些数据。
但是当我在下面查询 repository_notes 时:
print_r($this->db->get('repository_notes')->result_array());
它给了我以下结果集:
Array
(
[0] => Array
(
[note_id] => 1
[note_title] => This is my note
[note_content] => Lorem ipsum dolor sit amet, consectetur adipiscing elit. In laoreet lobortis lacus, ac iaculis risus tristique nec. Curabitur porta gravida est, non tincidunt nunc porta nec. Nunc diam metus, feugiat non lobortis
[note_userId] => 2302
[note_pageno] => 12
[note_deleted] => 0
[note_bookid] => 12
)
[1] => Array
(
[note_id] => 2
[note_title] => This is my note
[note_content] => Lorem ipsum dolor sit amet, consectetur adipiscing elit. In laoreet lobortis lacus, ac iaculis risus tristique nec. Curabitur porta gravida est, non tincidunt nunc porta nec. Nunc diam metus, feugiat non lobortis
[note_userId] => 2302
[note_pageno] => 12
[note_deleted] => 0
[note_bookid] => 12
)
但是当我运行下面的查询时:
print_r($this->db->get('repository_noteupdates')->result_array());
我没有得到结果:
Array
(
)
你们中有没有人以前见过这样的事情并有解决方案,我们将不胜感激。
最佳答案
所以我找到了解决方案。
看来,如果我从表名中删除名称更新,似乎就可以了。所以我调用了表 repository_noteupdata
而不是 repository_noteupdates
它现在正在运行。
感谢大家的帮助。这很奇怪,因为我在 codeigniter 中找不到任何文档说更新是表名的保留字。
关于database - Codeigniter ActiveRecord 不返回特定 tableUn 的任何结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12804389/