php - how to send a mail if email id already exist in database? -




code:

<?php     if($this->input->post('send'))     {         $email = $this->input->post('email');          $this->db->select('password,firstname');         $this->db->from('user');         $where = "email = '$email'";         $this->db->where($where);         $query = $this->db->get();         if ($query->num_rows() > 1)         {             $result = $query->result_array();             foreach ($result $row)              {                 $password = $row['password'];                 $firstname = $row['firstname'];             }             if($result)             {                 $toemail = $this->input->post('email');                 $fromemail = "info@xyz.com";                 $this->load->library('email');                  $this->email->from($fromemail, 'test');                  $this->email->to($toemail);                 $this->email->subject('user login password');                  $body="hi ".$firstname."your login password ".$password."";                 $this->email->message($body);                  $this->email->send();                 if (!$this->email->send())                  {                      print_r($this->email->print_debugger(), true);                  }                 else                 {                     echo '<p style="color: red;font-weight: bold;">error!.</p>';                 }                 echo '<p style="color: #41b212;font-weight: bold;">kindly check email password.</p>';             }         }         else         {             echo '<p style="color: red;font-weight: bold;">your email id not exist.</p>';         }      } ?>  <form method="post">     <div class="form-group">         <input type="text" name="email" id="email" placeholder="enter email" class="text-line"/>     </div>     <div class="form-group">         <input type="submit" name="send" id="send" value="send" class="btn btn-warning"/>     </div> </form> 

in code have create reset password form. here, have table having name user. now, when click on send button show email id not exist. creating if user email id exist send mail user having email id in user table. so, how can ?please me.

thank you

condition checking have issue change

if ($query->num_rows() > 1) 

to

if ($query->num_rows() > 0) 




wiki

Comments

Popular posts from this blog

firebase - How to wait value in Ionic 2 -

Jenkins: find build number for git commit -

ROS vtk and kubuntu problems -