zanaticul
(Cosmincb)
April 4, 2011, 11:46am
1
i can`t figure out how to solve this exception:
" Column name must be either a string or an array. "
i think is something that has to do with ar
i have three tables
Tags TagSongRel Songs
i am saving the tag and song an getting their id,
and after that i want to save the relation between both of them with this code
public function add($id_song, $id_tags) {
$this->id_song = $id_song;
foreach ((array)$id_tags as $key => $id_tag) {
$this->id_tag = $id_tag;
if(!$this->save()) {
echo 'error saving song artist rel';
exit;
}
}
}
when i call $this->save() in the TagSongRel i get the exception
thanks in advance
Can you post your entire controller & model code?
Thanks
Cosmin:
i can`t figure out how to solve this exception:
" Column name must be either a string or an array. "
i think is something that has to do with ar
i have three tables
Tags TagSongRel Songs
i am saving the tag and song an getting their id,
and after that i want to save the relation between both of them with this code
public function add($id_song, $id_tags) {
$this->id_song = $id_song;
foreach ((array)$id_tags as $key => $id_tag) {
$this->id_tag = $id_tag;
if(!$this->save()) {
echo 'error saving song artist rel';
exit;
}
}
}
when i call $this->save() in the TagSongRel i get the exception
thanks in advance
zanaticul
(Cosmincb)
April 13, 2011, 7:53am
3
to make the error disappear i had to add a new column with a primary key on the relational table.
what i dont understand is why i need an primary key in every table, even in a relation table where all i need to store is the ids of the rows primary keys. the relation table primary key is not needed because i don
t care about order or only a row.
Thanks,
Cosmin