Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Database Codeigniter ActiveRecord不返回特定表的任何结果_Database_Codeigniter_Activerecord - Fatal编程技术网

Database Codeigniter ActiveRecord不返回特定表的任何结果

Database Codeigniter ActiveRecord不返回特定表的任何结果,database,codeigniter,activerecord,Database,Codeigniter,Activerecord,从数据库中的一个特定表返回结果时出现问题 我有两张桌子: a) repository_notes b) repository_noteupdates (this one is giving the problem) 下图显示了使用Navicat的简单select*查询在两个表中都有一些数据 但是,当我查询以下存储库注释时: print_r($this->db->get('repository_notes')->result_array()); 它给出了以下结果集: A

从数据库中的一个特定表返回结果时出现问题

我有两张桌子:

a) repository_notes
b) repository_noteupdates (this one is giving the problem)
下图显示了使用Navicat的简单select*查询在两个表中都有一些数据

但是,当我查询以下存储库注释时:

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
    )
但是,当我运行以下查询时:

打印\r$this->db->get'repository\u noteupdates'->结果\u数组

我没有得到任何结果:

 Array
    (
    ) 

你们有没有人见过这样的事情,并且有了解决方案,我们将不胜感激。

所以我找到了解决方案

如果我从表名中删除名称更新,它似乎可以工作。所以我调用了表repository\u noteUpdatea,而不是repository\u noteupdates 现在它正在发挥作用


谢谢你们的帮助。这很奇怪,因为我在codeigniter中找不到任何说明update是表名的保留字的文档。

因此我找到了解决方案

如果我从表名中删除名称更新,它似乎可以工作。所以我调用了表repository\u noteUpdatea,而不是repository\u noteupdates 现在它正在发挥作用


谢谢你们的帮助。这很奇怪,因为我在codeigniter中找不到任何文档说明update是表名的保留字。

您是否尝试过类似$sql=SELECT*FROM repository\u noteupdates$query=$this->db->query$sql;打印\r$query->result\u数组;我刚试过,但没用。但是,如果我使用$sql=SELECT*FROM repository\u notes$query=$this->db->query$sql;打印\r$query->result\u数组;它对另一张桌子有效@WillsampsEntry打印\u r$this->db->last\u查询;并查看查询后实际查询的内容。这似乎是数据库的问题,而不是codeigniter的问题,我会确保您的表设置正确,并且可以从数据库配置文件中的设置访问这两个表。运行print\r$this->db->last\u query后,它似乎正在执行正确的查询SELECT*from repository\u noteupdates@johnb您是否尝试过类似$sql=SELECT*FROM repository\u note updates$query=$this->db->query$sql;打印\r$query->result\u数组;我刚试过,但没用。但是,如果我使用$sql=SELECT*FROM repository\u notes$query=$this->db->query$sql;打印\r$query->result\u数组;它对另一张桌子有效@WillsampsEntry打印\u r$this->db->last\u查询;并查看查询后实际查询的内容。这似乎是数据库的问题,而不是codeigniter的问题,我会确保您的表设置正确,并且可以从数据库配置文件中的设置访问这两个表。运行print\r$this->db->last\u query后,它似乎正在执行正确的查询SELECT*from repository\u noteupdates@约翰比特不应该这样,我怀疑这是另外一回事,但谁知道呢。很奇怪,这个变化为你解决了这个问题。不应该是这样,我怀疑这是另外一回事,但谁知道呢。很奇怪,这个变化为你解决了这个问题。