title: where to insert functions in codeigniter mongodb
body: <p>I have connected my php web app to mongodb with the help of codeigniter driver.</p>
  
  <p>now i am using the mongoo_db class to insert a collection into the default database, db_name.</p>
  
  <p>the source code of my files is,</p>
  
  <p>ghy.php</p>
  
  <pre><code>&lt;?php
  /**
  * @author
  * @copyright 2014
  */
  class ghy
  {
      public $id;
      public $name;
      public function insert($collection = "", $data = array()) {
          if(empty($collection))
              show_error("No Mongo collection selected to insert into", 500);
          if(count($data) == 0 || !is_array($data))
              show_error("Nothing to insert into Mongo collection or insert is not an array", 500);
          try {
              $this-&gt;db-&gt;{$collection}-&gt;insert($insert, array('safe' =&gt; TRUE));
              if(isset($insert['_id']))
                  return($insert['_id']);
              else
                  return(FALSE);
          } catch(MongoCursorException $e) {
              show_error("Insert of data into MongoDB failed: {$e-&gt;getMessage()}", 500);
          }
          $use=$this-&gt;mongo_db-&gt;insert('foo', $data = array('4','hgfh'));
          var_dump();
          }
      }
  ?&gt;
  </code></pre>
  
  <p>the problem is that i am not getting any output in my browser.</p>
  
  <p>can anyone plss explain me where am i going wrong? replies at the the earliest will be highly appreciated.</p>
  
  <p>thankyou </p>