I want to send 2 strings through array from controller to model and get the results from db, but there is a problem I'm facing.
My controller is like:
$data = array();
if($query = $this->authors_model->get_authors_list(array('author_Type' => array('admin', 'author'))))
{
$data['authors'] = $query;
}
My Model :
function get_authors_list($options = array())
{
if(isset($options['author_Type']))
$this->db->where('author_Type', $options['author_Type']);
$this->db->order_by('author_Id', 'ASC');
$query = $this->db->get('mg_authors');
return $query->result();
}
and the error I'm getting:
A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: database/DB_active_rec.php
Line Number: 427
Error Number: 1054
Unknown column 'Array' in 'where clause'
SELECT * FROM (
mg_authors) WHEREauthor_Type= Array ORDER BYauthor_IdASC LIMIT 15Filename: D:\xampp\htdocs\sport\system\database\DB_driver.php
Line Number: 330
$options['author_Type']array toAR::where()method, which generatesauthor_Type = Array. that's an error. - Hashem Qolami