CodeIgniter Forums
Model problems - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Model problems (/showthread.php?tid=45847)



Model problems - El Forum - 10-08-2011

[eluser]PrivateSniper[/eluser]
Ok despite all my efforts this particular code is starting to bug me, i've been following a tutorial, and I just cannot understand why this is not working, the error is showing as:

Quote:Parse error: syntax error, unexpected T_RETURN, expecting ')' in /model.php on line 15
(i have amended the url on this error message to hide my full path, can anyone please advise on why return is not working?

Code:
<?php
class Model extends CI_Model {

function __construct() {
parent::__construct();
}

function get(){
  $q = $this->db->get('table');

  foreach ($q->result() as $row {
    $data[] = $row
   }
  return $data->result();
  }
}
?>