issue with using join |
[eluser]kyleect[/eluser]
Here is a method from one of my models: Code: function get_newest($limit = NULL, $offset = NULL){ This is causing some real issues and I'm sure there is a simple solution. I have 2 tables. `entries` and `states`. Both have a field called `id`. Here is the code I'm using to display entries: Code: see below... since both tables have `id` as a field, it's pull the data from states and breaking my app. I'm very unfamiliar with JOINs outside of CI so any help would be great. How can I specify that I want the `id` field from `entries, not `states` If there is any information I've left out that will help, please let me know. -- For some reason the CI forum tries to parse what I'm pasting in so the code won't display correctly. Also, I can't attach a file renamed view_name.txt as the mime type is incorrect. Wow, I think breaking my own fingers would be more enjoyable than this. OK. So I'm using a pastebin to get this posted. Ridiculous. http://pastebin.com/m41d96e7e
[eluser]Matthieu Fauveau[/eluser]
Hi, Why not use $this->db->select('entries.id AS id'); ?
[eluser]kyleect[/eluser]
That worked! Database work is by far my weakest point. Thanks for the help.
[eluser]Matthieu Fauveau[/eluser]
No problem, glad to be of help from times to times ![]() |
Welcome Guest, Not a member yet? Register Sign In |