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
Call to a member function on a non-object
Old 01-12-2008, 07:49 PM Call to a member function on a non-object
Junior Talker

Posts: 1
Name: Luke
Trades: 0
I'm getting a 'Call to a member function on a non-object' error on line 25. ( I have commented line 25 for you). Any ideas what the problem might be?
PHP Code:
class categorygenerator {
   var 
$root_uniqueid 0,
       
$max_level 6,
       
$data = array(),
       
$root_start_string '',
       
$root_end_string '',
       
$parent_start_string '',
       
$parent_end_string '',
       
$parent_group_start_string '<ul%s>',
       
$parent_group_end_string "</ul>\n",
       
$child_start_string '<li%s>',
       
$child_end_string "</li>\n",
       
$spacer_string '',
       
$spacer_multiplier 1;
  function 
categorygenerator($load_from_database true) {
     global 
$db;
  
$this->data = array();
  
$categories_query "SELECT pagetitle, uniqueid, parentid FROM category WHERE uniqueid = 'uniqueid' ORDER BY parentid, pagetitle";
        
$categories $db->Execute($categories_query); // line 25
         
while (!$categories->EOF) {
           
$this->data[$categories->fields['parentid']][$categories->fields['uniqueid']] = array('name' => $categories->fields['pagetitle'], 'count' => 0);
        
$categories->MoveNext();
         }
  } 
avant is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-12-2008, 09:35 PM Re: Call to a member function on a non-object
Extreme Talker

Posts: 238
Location: United States
Trades: 0
It means $db is not an object.

I see that you have global $db; you may want to check where you are instantiating it at.
frost is offline
Reply With Quote
View Public Profile
 
Old 01-13-2008, 01:25 AM Re: Call to a member function on a non-object
Mattmaul1992's Avatar
Ultra Talker

Posts: 486
Name: Matt
Trades: -1
Yup.. What did you do with $db in your other files? Another thing to try is make sure your "execute" function isn't capitalized wherever you initialized it. I've only had this error once so I'm not sure if that'd be it but I really don't think so. Still something to try.
__________________
PHP Code:
$talkupation++; 

Please login or register to view this content. Registration is FREE
- Free IPB forum hosting (releasing today!!!), no ads, free modifications

Last edited by Mattmaul1992; 01-13-2008 at 01:29 AM..
Mattmaul1992 is offline
Reply With Quote
View Public Profile
 
Old 01-13-2008, 01:30 AM Re: Call to a member function on a non-object
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
I think this code is modified from something like Zen Cart or OSC, if memory serves. It'd really depend on when the function is called. I'd say to go back and check the calling script and go from there. Also, the function declaration has a parameter that is never used, so why include it?
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 01-21-2008, 09:11 PM Re: Call to a member function on a non-object
carloncho's Avatar
Skilled Talker

Posts: 80
Name: Carlos
Trades: 0
1) You dont include a file with db class
2) You type wrong the method name 'Excecute'
3) The db class not create the cnnection or something wrong more on top of the code. Set error_reporting(E_ALL) prior file of db class to view if there is previous errors.
__________________
-----------------------

Please login or register to view this content. Registration is FREE
carloncho is offline
Reply With Quote
View Public Profile Visit carloncho's homepage!
 
Reply     « Reply to 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.21452 seconds with 12 queries