PDA

View Full Version : Fatal error: Call to a member function on a non-object


SilentK
16 Jun 2005, 20:57
I have a query that used to work before I installed 3.5 Now I get this error message whenever I load the page
Fatal error: Call to a member function on a non-object in /./././htdocs/widget.php on line 5

This is the contents of widget.php



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


That worked before 3.5. What changed? and what do I need to change to make it work?

Also I would like to get it so the links are formatted like this


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I've tried


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



but I get a parse error.
Thanks in advance.

Andreas
16 Jun 2005, 21:05
That worked before 3.5. What changed? and what do I need to change to make it work?


$DB_site is now $db.

And you should use query_read/query_write instead of just query depending if you are reading from or writing to the database.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


should work.

The htmlspecialchars_uni() is necesarry, otherwise you create an XSS vulnerbilitie.

SilentK
16 Jun 2005, 21:51
Hmmm that fixed the error and appears to be formatting the link correctly. What I am trying to do is create a widget for mac os 10.4 so far the only way I have found to get a widget to open up a link in safari is javascript:widget.openURL

From what I can tell the php file is doing it's job perfectly.
Here's an example of a link that it's pumping out.


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


That should work because I have tested.


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


Directly inside the widge and it works. I am guessing there must be an issue with the way I am loading the links into the widget.

here's the body of the widget


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


From the testing I have done the iframe is causing the problem. The reason I think this is I created a file with just

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


and loaded it via an Iframe and it didn't work either. By not working I mean when I click the link nothing happens.

Is there a better way to load the links in?
widgets support javascript, and html.