Hello All.
I currently am creating a book inventory system with CodeIgniter (am new to CodeIgniter) and I would like each of the books to have to have tags.
Currently, I have 4 tables:
- Books
- Tags
- BooksTags (matches bookid to tagid)
- Collections (series collection)
In the controller for the main view which will show all the books, I call this:
$this->db->select('*');
$this->db->from('books');
$this->db->join('collections', 'collections.collectid= books.collectionid');
$data['query'] = $this->db->get();
The join helps me get the collection each book belongs too.
So in the view, I loop through the query and get all the books and display them in a table format. What I am hoping to accomplish is to add a row under each book and put the tags. My SQL skills are lacking and I would normally just put a bunch of select statements, but I want to do all the work from the controller. I attempted a couple of different things, but I am not sure how to get all the tags for each book as it loops through.
Any help would be greatly appreciated.
Thanks!