I want to get the value of column 'no' from the database and after that i want to mail this value to the user, but i got some error..
Here is the query which i have written for getting the value in the model and the function sendmail() which i have written to send the mail to the user in the controller..
Model: User_model
public function get_client_id()
{
$email = $this->input->post('email');
$query = $this->db->query("SELECT no FROM users WHERE email = '$email' LIMIT 1");
$result = $query->result_array();
$value = mysql_fetch_object($result);
$_SESSION['myid'] = $value->no;
}
Controller: Users.php
public function sendmail()
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_port' => '465',
'smtp_user' => 'something@gmail.com',
'smtp_pass' => '******',
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$data = $this->user_model->get_client_id();
$message = print($_SESSION['myid']);
$this->load->library('email', $config);
$this->email->from('dharavihol119@gmail.com', 'Dhara Vihol');
$this->email->to($_SESSION["email"]);
$this->email->subject('You have successfully signed up');
$this->email->message($message);
if ( ! $this->email->send())
{
echo "There is some error!";
echo $this->email->print_debugger();
}
else
{
echo "Mail is sent successfully";
echo $this->email->print_debugger();
}
}
And these errors are being shown...
https://i.stack.imgur.com/vqAyR.png
But the mail is sent to the user and it always prints the 1 into the mail.
Please help me.. :(