database - Codeigniter ActiveRecord 不返回特定 tableUn 的任何结果

标签 database codeigniter activerecord

从数据库中的一个特定表返回结果时遇到问题。

我有两个表:

a) repository_notes
b) repository_noteupdates (this one is giving the problem)

这是一张图片,使用 Navicat 使用简单的 select * 查询显示两个表中都有一些数据。

enter image description here http://imgur.com/GA6bn

但是当我在下面查询 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/

相关文章:

database - 我应该使用 EBS 还是 S3 来存储我的数据库?

php - 无法将值绑定(bind)到数据库 php 中的表

codeigniter - 支付流错误 52 : Insufficient permissions to perform transaction in test mode

php - 如何在sql中选择多级类别的产品?

ruby-on-rails - 具有两个多态 has_many 到 : associations for object tagging 的 Rails 模型

zend-framework - DataMapper 模式会破坏 MVC 吗?

mysql - 如何优化MySQL多表select查询?

php - MySQL模式,哪种方式性能更高? M-N 关系还是将所有相关 ID 保存为字符串?

用于多选的html组合框或选择框

ruby-on-rails - 使用 ActiveRecord 总和进行排序和限制?