EllisLab text mark
Advanced Search
     
Very odd PHP error
Posted: 26 July 2007 01:17 AM   [ Ignore ]
Avatar
Joined: 2007-05-22
85 posts

Okay I’m getting a odd error, I do not get this on my local PHP5 server but I do on my web host which also runs PHP5.

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/.leucon/cpccody/codypchristian.net/system/application/controllers/home.php on line 114

and here is whats on line 114:

$query $this->db->where('ip'$ip)->limit(1)->get('banned'); 

I will have to figure out something cause I use code like that all over the place, and would rather use it that way then the other way.

 Signature 

Thanks, CodyPChristian

More about me here: CodyPChristian.net
Host of LearnCI - learn-codeigniter.com

 
Posted: 26 July 2007 01:38 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2006-06-23
370 posts

What platform is your webhost?
Is it running PHP as CGI or module?

 Signature 

Mac OS X 10.8, Apache 2.x, NGiNX, PHP 5.4.x, CodeIgniter 1.7.2/2.1.3

 
Posted: 26 July 2007 11:11 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2007-05-22
85 posts

As CGI if I remember correctly.

 Signature 

Thanks, CodyPChristian

More about me here: CodyPChristian.net
Host of LearnCI - learn-codeigniter.com

 
Posted: 26 July 2007 11:20 AM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2006-06-23
370 posts

And which platform? Linux or Windows?

 Signature 

Mac OS X 10.8, Apache 2.x, NGiNX, PHP 5.4.x, CodeIgniter 1.7.2/2.1.3

 
Posted: 26 July 2007 11:25 AM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Avatar
Joined: 2007-05-22
85 posts

Linux server. Keep In mind this is at a webhost not here, my local server works just fine but its php as a module not as CGI like my webhost is.

I fixed the first one by doing this:

$this->db->where('ip'$ip);
$this->db->limit(1);
$data['query'$this->db->get('banned'); 

instead of

$query $this->db->where('ip'$ip)->limit(1)->get('banned'); 

Okay, but now I’m getting other errors in other places, gah this irrates me cause it works fine locally. Here is the new error and the code.

Fatal error: Call to a member function on a non-object in /home/.leucon/cpccody/codypchristian.net/system/application/controllers/home.php on line 120

line 120:

if ($query->num_rows() > 0

Here is the full code of this function:

//check the IP and see if its in the banned database
    
function ip_check($ip)
    
{
        
//$query = $this->db->where('ip', $ip)->limit(1)->get('banned');
        
        
$this->db->where('ip'$ip);
        
$this->db->limit(1);
        
$data['query'$this->db->get('banned');

        if (
$query->num_rows() > 0)
        
{
            
//if a match then throw a error
            //values returned from database -- must be a match
            
$this->validation->set_message('ip_check''Sorry but your IP matches a IP in the banned list');
            return 
FALSE;
        
}
        
else
        
{
            
//if not a match then throw no error
            
return TRUE;

        
}
    } 
 Signature 

Thanks, CodyPChristian

More about me here: CodyPChristian.net
Host of LearnCI - learn-codeigniter.com

 
Posted: 26 July 2007 01:19 PM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2007-02-06
743 posts

I’m pretty sure that your php host has you on php4. Echo phpinfo() and check the version at the top of the screen. As for the new error - the problem is that you commented out the $query variable.

 Signature 

“I am the terror that flaps in the night”

 
Posted: 26 July 2007 01:42 PM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Avatar
Joined: 2006-06-23
370 posts

Yes, if you had to remove the method chaining, then you don’t have php5.

 Signature 

Mac OS X 10.8, Apache 2.x, NGiNX, PHP 5.4.x, CodeIgniter 1.7.2/2.1.3

 
Posted: 26 July 2007 01:54 PM   [ Ignore ]   [ # 7 ]   [ Rating: 0 ]
Joined: 2007-02-20
23 posts

Was just about to say… like these guys.. it looks like you’re on php4 on your host.  You already know how to fix your problem.  php4 doesnt allow method chaining.

 
Posted: 26 July 2007 01:54 PM   [ Ignore ]   [ # 8 ]   [ Rating: 0 ]
Avatar
Joined: 2007-05-22
85 posts

Ah! It is php 4 grr, PHP Version 4.4.7, I know my host has php5, I will have to look into getting up to php5 then. Also to fix the second problem I did the following:

$this->db->where('ip'$ip);
        
$this->db->limit(1);
        
$query $this->db->get('banned'); 

Thanks again guys

 Signature 

Thanks, CodyPChristian

More about me here: CodyPChristian.net
Host of LearnCI - learn-codeigniter.com

 
Posted: 26 July 2007 03:30 PM   [ Ignore ]   [ # 9 ]   [ Rating: 0 ]
Avatar
Joined: 2007-05-22
85 posts

Thanks for everyones help, I got my site switch to 5.2.2 and found out that it was the only one out of all of my sites that was on 4.x, so thanks for the help smile

 Signature 

Thanks, CodyPChristian

More about me here: CodyPChristian.net
Host of LearnCI - learn-codeigniter.com