从数据库中的某个特定表返回结果时遇到问题。
我有两张桌子:
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($这 - > DB->获得( 'repository_noteupdates') - > result_array());
我没有结果:
Array
(
)
你们之前有没有见过这样的事情,并且有一个解决方案,我们将不胜感激。
答案 0 :(得分:0)
所以我找到了解决方案。
似乎如果我从表名中删除名称更新,它似乎工作。所以我调用了表repository_noteupdata
而不是repository_noteupdates
它现在正在运作。
谢谢你们的帮助。这很奇怪,因为我在codeigniter中找不到任何文档,说update是表名的保留字。