[eluser]webnology[/eluser]
Hi all,
I have a table with bands, and a table with genres. I also have a table that links both. So aband can have multiple genres. Now I want to show all genres that have not been assign to aband yet.
So I'm trying this: Get all genres in the bands2genre table, and the use that array as an exclusion for the genre table.
Code:
//Get all genres, except those assigned to the band
function getAllGenres($bandid) {
$this->db->select('genre_id');
$this->db->where('band_id', $bandid);
$this->db->from('bands2genre');
$assigned_genres = $this->db->get();
$this->db->select('*');
$this->db->from('genres');
$this->db->where_not_in('genre_id', $assigned_genres);
//Get the records according to the above SQL statements
$Q = $this->db->get();
return $Q;
}
However, Im having errors: like this:
Code:
A PHP Error was encountered
Severity: Notice
Message: Object of class CI_DB_mysql_result to string conversion
Filename: database/DB_active_rec.php
Line Number: 586
A Database Error Occurred
Error Number: 1054
Unknown column 'Object' in 'where clause'
SELECT * FROM (`genres`) WHERE `genre_id` NOT IN (Object)
So, is my $assigned_genres not an array?
Any help appreciated!
Michel