CodeIgniter Forums
'expecting t-function error' issues - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: 'expecting t-function error' issues (/showthread.php?tid=21453)



'expecting t-function error' issues - El Forum - 08-10-2009

[eluser]richzilla[/eluser]
hi all, im in the middle of following a net tuts tutorial on the internet and all is going well until i start playing with data access. Basically one of my models is throwing the above error. I understand from google that contrary to what it says it is actually caused by too many semi colons rather than not enough but i really cant see ehat the probelm is. Yoll have to bear with me if the problems very simple, im very new to php...

my code is included below:

Code:
<?php
    class Data_model extends Model {
    
        function Data_model() {
            parent::model();
        }
        
        /*function getData() {
            $q = $this->db->query("SELECT * FROM data");
            if ($q->num_rows() > 0)
            {
                foreach ($q->result() as $row)
                {
                    $data[] = $row;
                }
                
                return $data;
            }
        }*/
        
        /*function getData() {
            $q = $this->db->get('data');
            
            if($q->num_rows() > 0)
            {
                foreach ($q->result() as $row)
                {
                    $data[] = $row;
                }
                
                return $data;
            }
        }*/
        
        function getData() {
            $this->db->select('title , contents');
            $q = $this->db->get('data');
            
            if($q->num_rows() > 0)
            {
                foreach ($q->result() as $row)
                {
                    $data[] = $row;
                }
                
                return $data;
            }
        }
?>

once again any help would be very appreciated.

thanks


'expecting t-function error' issues - El Forum - 08-10-2009

[eluser]richzilla[/eluser]
and ive just realised 'bear with me'..... i must be getting tired...


'expecting t-function error' issues - El Forum - 08-10-2009

[eluser]Johan André[/eluser]
Maybe try to close the class with a }?

And leave out the closing php-tag. It's bad practice and it can cause you more damage than Chuck Norris...


'expecting t-function error' issues - El Forum - 08-10-2009

[eluser]richzilla[/eluser]
cheers, its always something little....