I would like to take a textfield input (job) and store it in my database with a comma separated list. This is what I've tried:
public function __saveNewJob($newJob,$jobscopeChosen) {
$jobId = $this->__getScopeId($jobscopeChosen);
$jobList = $this->__getJoblist($jobId);
$jobList_comma = explode(",",array_filter($joblist));
$jobList_array = array_push($jobList_comma,$newJob);
$jobList_save = implode(",",$jobList_array);
$query = "UPDATE xxxx SET jobs='".$jobList_save."' WHERE id='$jobId'";
$result = mysql_query($query) OR die(mysql_error());
$newJob is the string from my textfield which I'd like to save.
$jobscopeChosen is a value from a select box.
The table in the database, named jobs, should be like Designer, Producer, Administration etc.
My idea was to get the comma separated list, explode it to an array, push the new value and implode it again to a string.
My database says Array in my table. I'm desperate. What am I doing wrong? Any ideas?
explode()on an array -- it requires a string, not an array. I'd suggest enabling error reporting to see what's really going wrong.