get_browser().....error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cali_dotcom
Forum Commoner
Posts: 49
Joined: Fri Aug 22, 2008 7:28 pm
Location: Rancho Cucamonga, CA

get_browser().....error

Post by cali_dotcom »

hi, i'm trying to edit something on a site i didn't code myself so i downloaded the files and set them up on a virtual host on my local machine. i am using wamp server with php v 5.2.9-2. the problem is when i go the page on my local machine i get this error:
Notice: Trying to get property of non-object in C:\wamp\www\yikers\common\browser.php on line 18
here is the code:

Code: Select all

 
public function isIE()
    {
        $b = get_browser();
        
        if ($b->parent == 'IE 6.0' || $b->parent == 'IE 5.5' || $b->parent == 'IE 5.01')  //this is line 18
            return true;
        else
            return false;
    }
 
does anyone know what the problem could be?
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Re: get_browser().....error

Post by SidewinderX »

$b is not an object - it is an associative array as a result you access elements using the following syntax: $b['parent']
cali_dotcom
Forum Commoner
Posts: 49
Joined: Fri Aug 22, 2008 7:28 pm
Location: Rancho Cucamonga, CA

Re: get_browser().....error

Post by cali_dotcom »

thanks man, that worked real good...
Post Reply