I was trying to find out the error but I coudnt. I use codeigniter. Here is the code
function send_emailalertstoAdmin($emailmessage,$ad_title)
{
$this->load->model('user_model');
$query_result = $this->user_model->load_administrator_email();
//$this->load->database();
//$query = $this->db->query('SELECT users.email FROM users WHERE users.id =1');
foreach ($query_result as $row)
{
$email= $row->email;
$successmasg = '';
$from = "info@xxxt.com";
$subject = "xxx ". $ad_title . " is Stolen";
$message = $emailmessage;
$headers = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
$headers .= 'From: xxxxx.com <info@xxxxt.com>' . "
";
$successmasg = mail($email, $subject, $message, $headers);
}
}
I got the following error. Fatal error: Call to undefined method User_model::load_administrator_email()
Here is the load_administrator_email() function
function load_administrator_email()
{
$sql = "SELECT users.email FROM users WHERE users.id =1";
$queryData = $this-> db->query($sql);
return $queryData -> result();
}
I was trying to find the error but I coudnt. what I tried, 1. sql query is correct and it gives correct result. 2. when I hardcode email and comment calling load_administrator_email() in first function ,email goes correctly.
please help me to correct this.
thx in advance