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 as $row) 
            {
                $password = $row['password'];
                $firstname = $row['firstname'];
            }
            if($result)
            {
                $toEmail = $this->input->post('email');
                $fromEmail = "[email protected]";
                $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 is ".$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 your email to get your password.</p>';
            }
        }
        else
        {
            echo '<p style="color: red;font-weight: bold;">Your email id does not exist.</p>';
        }

    }
?>

<form method="post">
    <div class="form-group">
        <input type="text" name="email" id="email" placeholder="Enter Your 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 this code I have create a reset password form. Here, I have a table having name user. Now, When I click on send button it always show Your email Id does not exist. But I am creating if user email Id already exist it will send to the mail to that user who having email Id in user table. So, How can I do this ?Please help me.

Thank You

Condition you are checking have an issue
change

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

to

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