943,681 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 773
  • PHP RSS
Aug 21st, 2009
0

get_browser().....error

Expand Post »
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:
PHP Syntax (Toggle Plain Text)
  1. public function isIE()
  2. {
  3. $b = get_browser();
  4.  
  5. if ($b->parent == 'IE 6.0' || $b->parent == 'IE 5.5' || $b->parent == 'IE 5.01') //this is line 18
  6. return true;
  7. else
  8. return false;
  9. }

does anyone know what the problem could be?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
cali_dotcom is offline Offline
51 posts
since Apr 2008
Aug 21st, 2009
0

Re: get_browser().....error

The problem is that get_browser returns an array, not an object. use $b['parent'] , not $b->parent
Sponsor
Reputation Points: 520
Solved Threads: 268
Code Monkey
ShawnCplus is offline Offline
1,564 posts
since Apr 2005
Aug 21st, 2009
0

Re: get_browser().....error

Try the following:
php Syntax (Toggle Plain Text)
  1. public function isIE()
  2. {
  3. $b = get_browser(null, true);
  4.  
  5. if ($b['browser']=='IE')
  6. return true;
  7. else
  8. return false;
  9. }
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007
Aug 21st, 2009
0

Re: get_browser().....error

thanks man, that was the problem. works fine now..
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
cali_dotcom is offline Offline
51 posts
since Apr 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: building table with php
Next Thread in PHP Forum Timeline: PHP Parse error: syntax error, unexpected T_VARIABLE





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC