CodeIgniter Forums

Full Version: preg_match() expects parameter 2 to be string, array given
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've problem with my controller and i need ur help  Big Grin
this is my syntax. I want to get data smtp_user from my DB:

$config['protocol']      =  "smtp";
$config['smtp_host']   =  "ssl://";
$config['smtp_port']   =  "465";
$config['smtp_user']   =  $this->db->select('email')->get('tb_contact')->result();    // the problem is here----
$config['smtp_pass']  =  $this->db->select('password')->get('tb_contact')->result();    // the problem is here----
$config['mailtype']     =  "html";
$config['charset']       =  "iso-8859-1";
$config['wordwrap']   =  TRUE;

thank youu

You are running a SQL statement in the controller instead of calling a model method that returns the string value that you need.

example ( )

$config['smtp_user'] = $this->User_model->getuser_email($user_id);

MODEL User_model (public function in mode User_model)
public getuser_email($user_id)
//do sql call to get information

return email_value;