Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Fatal error: Call to a member function on a non-object
Old 04-23-2008, 05:41 AM Fatal error: Call to a member function on a non-object
Novice Talker

Posts: 8
Trades: 0
Fatal error: Call to a member function on a non-object in /home/salonart/public_html/gangster-warfare/forums.php on line 704


line 704 - $topic=$db->fetch_row($q);

PHP Code:
function deletopic()
{
$q=$db->query("SELECT * FROM forum_topics WHERE ft_id={$_GET['topic']}");
$topic=$db->fetch_row($q);
$db->query("DELETE FROM forum_topics WHERE ft_id={$_GET['topic']}");
$db->query("DELETE FROM forum_posts WHERE fp_topic_id={$_GET['topic']}");
print 
"Deleting topic... Done<br />";
recache_forum($topic['ft_forum_id']);
stafflog_add("Deleted topic {$topic['ft_name']}"); 
MLOVELL is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-23-2008, 10:05 AM Re: Fatal error: Call to a member function on a non-object
addonchat's Avatar
Super Talker

Posts: 115
Name: Chris Duerr
Trades: 0
Looks like you're using a custom object to handle database queries, and not the standard vendor database extension functions. Is fetch_row a method $DB's class? Is it being called correctly. I've seen a fetch_row function in Invision Power Board, but don't recall a parameter being passed to it.
__________________
Chris Duerr
AddonChat Java Chat Software

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
addonchat is offline
Reply With Quote
View Public Profile
 
Old 04-23-2008, 10:52 AM Re: Fatal error: Call to a member function on a non-object
Ultra Talker

Posts: 310
Trades: 0
You haven't initialized $db variable.
dman_2007 is offline
Reply With Quote
View Public Profile
 
Old 04-24-2008, 01:56 AM Re: Fatal error: Call to a member function on a non-object
phpknowhow's Avatar
Skilled Talker

Posts: 83
Name: Colin
Location: USA
Trades: 0
Quote:
Originally Posted by dman_2007 View Post
You haven't initialized $db variable.
Exactly. Since the $db variable has local scope, it must be accessed another way, or defined within the function. You could define it as a global, and access it that way as well.
__________________

Please login or register to view this content. Registration is FREE
| Freelance PHP solutions for small to midsized projects |
Please login or register to view this content. Registration is FREE
phpknowhow is offline
Reply With Quote
View Public Profile Visit phpknowhow's homepage!
 
Reply     « Reply to Fatal error: Call to a member function on a non-object
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15240 seconds with 12 queries