How to check availability for user and email address in codeigniter?
<p>I'm trying to register new user with my MVC, all good except Availability Check, that I want to check that username and email address is already there in database or not, with an error if not available on new registration. I'm new to CodeIgniter, need help in this.
This is my Controller</p>

<pre><code>&lt;?php 
class Add_new_user extends CI_Controller {
    function index(){
        $this-&gt;load-&gt;view('signup_view');// loading form view
    }

function insert_into_db(){
    $user = array(
            "fname" =&gt; $_POST["fname"],
            "lname" =&gt; $_POST["lname"],
            "email" =&gt; $_POST["email"],
            "username" =&gt; $_POST["username"],
            "gender" =&gt; $_POST["gender"],
            "phone" =&gt; $_POST["phone"],
            "address" =&gt; $_POST["address"],
            );

    $this-&gt;load-&gt;model('signup_model');
    $result=$this-&gt;signup_model-&gt;insert_into_db($user);     


    if($result==1){
        $this-&gt;load-&gt;view('thanks_page');
    }
   }
  }
?&gt;
</code></pre>

<p>This is my Model</p>

<pre><code>&lt;?php 

class Signup_model extends CI_Model{

    public function __construct() {
      parent::__construct();
      }
    function insert_into_db($data)
    {
            if( 

            $result=$this-&gt;db-&gt;insert('gymers', $data) ) {
                return $result;
            } 
            else {
                echo "ERROR";
            }
        }
   }
?&gt;
</code></pre>

<p>Please help in this. Thank You.</p>