I have am creating a check function that enables me to check that data with the specific id and categoryid is already present in the database:
$fields['Occupation'] = array(3) { [0]=> string(1) "1" [1]=> string(1) "6" [2]=> string(1) "7" }
Line in question:
$occCheck = Jojo::selectQuery("SELECT * FROM {refocus_candidate_category} WHERE canid=? AND categoryid=?", array($emailCheck['id'], $fields['Occupation']));
Why am I getting this Error and how do I resolve:
Unknown column 'Array' in 'where clause'
Full Check Function:
if($occCheck != FALSE)
{
Jojo::updateQuery("UPDATE {refocus_candidate_category} SET canid=?, categoryid=? WHERE canid=? AND categoryid=?", array($emailCheck['id'], $fields['Occupation']));
}else{
Jojo::insertQuery("INSERT INTO {refocus_candidate_category} SET canid=?, categoryid=? WHERE canid=? AND categoryid=?", array($emailCheck['id'], $fields['Occupation']));
}
It’s not exactly clear what you are trying to do in your queries, as you are writing these strange values
SET canid=?.But the problem you are facing is, that you are concatinating entire array in your SQL query string. try to
echoan array then you will see it getting printed asArray. That’s the source of your problem query gets expanded likesomeField=Array. Now thatArrayis not even in single quotes, so mysql is assuming it to be a column. Thus your error.Remove that
array($emailCheck['id'], $fields['Occupation']). And just set$emailCheck['id'], $fields['Occupation'][0]. yourfield['Occupation']is and entire array so choose some as per your need.