title: How to use $_GET in Codeigniter
body: <p>here is a url of my website, this url is used to call the post from database which its id=1</p>
  
  <p>http://<em>*</em>.com/?view=entry&amp;id=1</p>
  
  <p>i try in the model with this code</p>
  
  <pre><code>&lt;?php
  class inner_query extends CI_Model{
      // main shakli wow in slider 
      function get_current_entry(){
          $q= $this-&gt;db-&gt;query("SELECT * FROM hs_categories_cat INNER JOIN hs_news_nw ON id_cat=idcat_nw WHERE active_nw='1' AND id_nw={$id}");
          if($q-&gt;num_rows() == 1){
              foreach($q-&gt;result() as $row){
                  $data[]=$row;//new array to store every results returned from database 
              }
              return $data;//return with array results
          }
      }
  }
  </code></pre>
  
  <p><strong>and here is my controller</strong></p>
  
  <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  
  class entry extends CI_Controller {
      public function index()
      {
          $id=$_GET['id'];
          //load model of the current entry
          $this-&gt;load-&gt;model('inner_query');
          $data['get_current_entry'] = $this-&gt;inner_query-&gt;get_current_entry();
  
          $this-&gt;load-&gt;view('inner_page.php', $data);
      }
  
  }
  </code></pre>
  
  <p><strong>once check this page i get this error message</strong></p>
  
  <pre><code>A Database Error Occurred
  Error Number: 1064
  
  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
  
  SELECT * FROM hs_categories_cat INNER JOIN hs_news_nw ON id_cat=idcat_nw WHERE active_nw='1' AND id_nw=
  
  Filename: E:***\system\database\DB_driver.php
  
  Line Number: 330
  </code></pre>