Results 1 to 2 of 2

Thread: [RESOLVED] Call to a member function on a non-object

  1. #1

    Thread Starter
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Resolved [RESOLVED] Call to a member function on a non-object

    What does this mean? Ive included a file inside my php and im trying to access a function inside of it..not sure whats goin on..

    edit*
    figured it out.

    When including a file, you need to initiate a new class like so
    PHP Code:
    inc ('includes/class.myclass.php');
    $myquery = new myclass(); 
    Last edited by |2eM!x; Nov 16th, 2005 at 05:33 PM.

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: [RESOLVED] Call to a member function on a non-object

    A class is a template for an object, sort of like a mould. The object doesn't exist until you create it using the new operator.

    $myquery = new myclass();

    The above like is like saying, "create me an object using myclass as a tmeplate and assign its location to $myquery"
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width