title: CodeIgniter Model Function, getting synatx error
body: <p>I have written one codeigniter model function, but getting syntax error in php 7.. will you please suggest me changes</p>
  
  <p>Error near group by order by statements..</p>
  
  <p>My Code Snippet:</p>
  
  <pre><code>function listing($searchText = '', $page, $segment)
      {
          $this-&gt;db-&gt;select('tr.*,group_concat(tg.groundname) as grplist ');
          $this-&gt;db-&gt;from('tb_tournament as tr ');
          $this-&gt;db-&gt;join('tournamentground as tg', 'tr.tournamentId=tg.tournamentId', 'left'); 
  
           $this-&gt;db-&gt;where('tr.is_deleted','0');
          if(!empty($searchText)) {
              $likeCriteria = "  (tr.organizerName  LIKE '%".$searchText."%'
                              OR  tr.location  LIKE '%".$searchText."%'
                              OR  tr.phone  LIKE '%".$searchText."%'
                              OR  tr.email  LIKE '%".$searchText."%'
                              OR  tr.level  LIKE '%".$searchText."%'
                              OR  tr.gender  LIKE '%".$searchText."%')";
              $this-&gt;db-&gt;where($likeCriteria);
          }
  
  
           $this-&gt;db-&gt;group_by('tr.tournamentId');
           $this-&gt;db-&gt;order_by('tr.tournamentId', 'DESC'); 
           $this-&gt;db-&gt;limit($page, $segment);
           $query = $this-&gt;db-&gt;get();
  
           $result = $query-&gt;result();   
           //print"&lt;pre&gt;";
           //print_r($result);
           return $result;
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/vThrE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vThrE.png" alt="enter image description here"></a></p>