EllisLab text mark
Advanced Search
     
ActiveRecord not returning any results for particular table
Posted: 09 October 2012 11:58 AM
Joined: 2011-04-13
2 posts

Hey Guys,

Having a problem with returning results from one particular table in a database.

I have two tables:
a) repository_notes
b) repository_noteupdates (this one is giving the problem)

Here is an image showing there are some data in both tables using a simple select * query using Navicat. http://imgur.com/GA6bn

However I only get results from repository_notes

print_r($this->db->get('repository_notes')->result_array()); 

gives the result

Array
(
    
[0] => Array
        (
            
[note_id] => 1
            [note_title] 
=> This is my note
            [note_content] 
=> Lorem ipsum dolor sit ametconsectetur adipiscing elitIn laoreet lobortis lacusac iaculis risus tristique necCurabitur porta gravida estnon tincidunt nunc porta necNunc diam metusfeugiat 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 ametconsectetur adipiscing elitIn laoreet lobortis lacusac iaculis risus tristique necCurabitur porta gravida estnon tincidunt nunc porta necNunc diam metusfeugiat non lobortis
            [note_userId] 
=> 2302
            [note_pageno] 
=> 12
            [note_deleted] 
=> 0
            [note_bookid] 
=> 12
        
)
etc...
etc... 

However

print_r($this->db->get('repository_noteupdates')->result_array()); 

gives the result

Array
(

Have any of you guys seen anything like this before. It is really driving me crazy!

Thanks for reading.

 
Posted: 09 October 2012 01:49 PM   [ # 1 ]   [ Rating: 0 ]
Joined: 2011-04-13
2 posts

I have resolved the issue.

I renamed the problem table so that update is not part of the name. Now it is working.

FYI: You cannot use update in the name of a database table! smile