CodeIgniter App getting data from the wrong mySQL table? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: CodeIgniter App getting data from the wrong mySQL table? (/showthread.php?tid=12121) |
CodeIgniter App getting data from the wrong mySQL table? - El Forum - 10-07-2008 [eluser]Adam Griffiths[/eluser] You can also use PHP Code: $this->db->from('content_blog'); It might make no difference, but it's something to try. Oh and I'm still thrown on this line. PHP Code: if($id) It's really not needed. CodeIgniter App getting data from the wrong mySQL table? - El Forum - 10-07-2008 [eluser]Dave Blencowe[/eluser] It was in an earlier version, removed it now. CodeIgniter App getting data from the wrong mySQL table? - El Forum - 10-07-2008 [eluser]Dave Blencowe[/eluser] Changing the get_comments function in the model to this: Code: function get_comments($id) Gives me the following error: Code: A Database Error Occurred [b]EDIT: Ignore that, I'm an idiot lol. Changing it from content_blog to content_test does nothing. CodeIgniter App getting data from the wrong mySQL table? - El Forum - 10-07-2008 [eluser]xwero[/eluser] Yes because now you have two tables. My best guess is that the blog post has no comments. CodeIgniter App getting data from the wrong mySQL table? - El Forum - 10-07-2008 [eluser]Dave Blencowe[/eluser] Yeah I saw the error after I posted >_> And yeah, the blog post doesn't have any comments but why does that make it move to content_blog? I'm going to insert a piece of data and try it now. EDIT: Ok, well it seems to be taking the variables/results from both of them... CodeIgniter App getting data from the wrong mySQL table? - El Forum - 10-07-2008 [eluser]Dave Blencowe[/eluser] Ok, problem seems to be fixed now I have added data in to the table. Bit weird to be honest... CodeIgniter App getting data from the wrong mySQL table? - El Forum - 10-07-2008 [eluser]xwero[/eluser] And if you remove the comment again? CodeIgniter App getting data from the wrong mySQL table? - El Forum - 10-07-2008 [eluser]Dave Blencowe[/eluser] It display data from content_blog CodeIgniter App getting data from the wrong mySQL table? - El Forum - 10-07-2008 [eluser]xwero[/eluser] What is the code of the comment view? CodeIgniter App getting data from the wrong mySQL table? - El Forum - 10-07-2008 [eluser]Dave Blencowe[/eluser] mdl_blog.php comments function Code: function get_comments($id) blog.php Comments function Code: function comments() Comments_view.php Code: <br /> |