[eluser]mallix[/eluser]
Now from what I see the only thing that changes between books and uniforms are:
Books have: isbn, author, edition
Uniforms have: description, size
So for example you can create ONE table called ITEM
Take all the common fields in this table and ad another column with name "type" (refers to either book or uniform to keep the type of each entry in the db).
So now create one table with name ITEM_BOOK and one table with name ITEM_UNIFORM:
ITEM_BOOK (item_book_id, item_id, isbn, author, edition)
ITEM_UNIFORM (item_uniform_id, item_id, description, size)
Now you have connected all these items with "item_id" and you can create "join" queries to search on both per type or per title or both like:
$this->db->select('ITEM.*, ITEM_BOOK.*', ITEM_UNIFORM.*');
$this->db->from('ITEM');
$this->db->join('ITEM_BOOK', 'ITEM_BOOK.ITEM_ID = ITEM.ITEM_ID');
$this->db->join('ITEM_UNIFORM', 'ITEM_UNIFORM.ITEM_ID = ITEM.ITEM_ID');
$this->db->where(title like %$keyword%);
If this query does not give a match for you then switch to:
$this->db->select('ITEM.*, ITEM_BOOK.*');
$this->db->from('ITEM');
$this->db->join('ITEM_BOOK', 'ITEM_BOOK.ITEM_ID = ITEM.ITEM_ID');
$this->db->where(title like %$keyword%);
If this query does not give a match then again switch to the other table:
$this->db->select('ITEM.*, ITEM_UNIFORM.*');
$this->db->from('ITEM');
$this->db->join('ITEM_UNIFORM', 'ITEM_UNIFORM.ITEM_ID = ITEM.ITEM_ID');
$this->db->where(title like %$keyword%);
That s how I would do it anyway.