1 (edited by Mako 2005-01-28 08:45)

Topic: Help with Error Message

I'm trying to work on my Easy Smilies mod (adding a delete feature for smilies), and I hit a wall with this error message:

Fatal error: Call to a member function query() on a non-object in C:\apachefriends\xampp\htdocs\punbb\plugins\AP_EasySmiles_delete.php on line 57

Line 57 is:

$db->query('DELETE FROM '.$db->prefix."smilies WHERE text = '$toremove'") or error('Unable to delete smiley', __FILE__, __LINE__, $db->error());

Any help? I don't see a problem with that query. $toremove is not empty, I echo'd it and it displayed what it contained correctly. I don't know, maybe my sleepiness is causing me to miss something out in the open.

Any help would be greatly appreciated.

"You start coding. I'll go find out what they want." - Computer Analyst to Programmer

Re: Help with Error Message

Is this in a function? In that case you need to add "global $db;" at the top of the function.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3

Re: Help with Error Message

No it wasn't with in a function. I was able to fix it though. I ended up moving it back to the original plugin page. I think some of the includes/requires were not being initiated with the script, causing the error.

"You start coding. I'll go find out what they want." - Computer Analyst to Programmer