Welcome Guest, Not a member yet? Register   Sign In
Email Function
#1

[eluser]Unknown[/eluser]
Hello,

I am using an email function - it works as expected when testing to myself. However, I can't seem to get an email field selected from a database to populate a variable :

Code:
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username','trim|required|callback_forgot_pass_username_check');
$this->form_validation->set_error_delimiters('', '<br />');
if ($this->form_validation->run() == TRUE)
{    // grab registered users email and send them the link
$this->db->select('email')->where('username', $this->input->post('username'));
$query = $this->db->get('users');
$this->email->from('[email protected]', 'Hello World');
$this->email->to($query);
$this->email->subject('Some Topic');
etc.....

I am trying to select from the database --&gt; table users ---&gt; email, then use that variable as $query - Any thoughts?

EDIT : Just noticed this may be in the wrong forum - move as needed - thanks.
#2

[eluser]hugle[/eluser]
Hello,
try;

Code:
$email = $this->db->select('email')->where('user_id', 1)->get('users')->row()->email;

you select the user email from database whose user ID is euqal to 1...
home that helps you somehow Smile
#3

[eluser]Unknown[/eluser]
Thanks hugle. I was able to break that down and engineer it to work in my case. Thank you!




Theme © iAndrew 2016 - Forum software by © MyBB