get_browser().....error

Thread Solved

Join Date: Apr 2008
Posts: 35
Reputation: cali_dotcom is an unknown quantity at this point 
Solved Threads: 0
cali_dotcom cali_dotcom is offline Offline
Light Poster

get_browser().....error

 
0
  #1
Aug 21st, 2009
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:
  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?
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 1,405
Reputation: ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light 
Solved Threads: 225
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is offline Offline
Code Monkey

Re: get_browser().....error

 
0
  #2
Aug 21st, 2009
The problem is that get_browser returns an array, not an object. use $b['parent'] , not $b->parent
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,483
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Re: get_browser().....error

 
0
  #3
Aug 21st, 2009
Try the following:
  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. }
Try not to bump 10 year old threads as it can be really annoying.
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*`
My favourite PC. - MacGyver Fan
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 35
Reputation: cali_dotcom is an unknown quantity at this point 
Solved Threads: 0
cali_dotcom cali_dotcom is offline Offline
Light Poster

Re: get_browser().....error

 
0
  #4
Aug 21st, 2009
thanks man, that was the problem. works fine now..
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC