l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
August 5: Social gathering
Next Installfest:
TBD
Latest News:
Jul. 4: July, August and September: Security, Photography and Programming for Kids
Page last updated:
2005 Dec 09 15:28

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] PHP: My object's method vanishes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] PHP: My object's method vanishes



This is for a wishlist program that I've been developing for my family.

I have a class called Person which looks something like this:

========================================

class Person {

  var $personFullName;
  var $recipientList;

  function Person ($personKey) {
    global $CFG;
    $personQuery = "select * from ".$CFG->db['prefix']."person where
personKey = $personKey";
    if (!$person = dbquery($personQuery)) {
      return false;
    }
    $this = $person[0];
    $this->personFullName = $this->personFirstName . " " .
$this->personLastName;

  }

  function bob() {
  }

}

========================================

I can call the constructor object just fine with:

========================================

$USER = new Person($userKey);

========================================

However, when I try this:

========================================

USER->bob()

========================================

I get this error:

========================================

Fatal error: Call to undefined function: bob()

========================================

...which I don't understand at all, since I have another Class which is
called in pretty much the same way, and I have no problem calling any
methods for that other class.  I can't find any significant structural
differences between the two classes.

I tried introducing a deliberate error into the definition for the
function bob(), and sure enough the program died when the page with the
malformed function was loaded.

I'm sure I'm missing something very obvious which will embarrass me
completely once it's pointed out to me, but at the moment I have no idea
what it might be.

-- 
Richard S. Crawford
http://www.mossroot.com
"That which does not kill me makes me stranger."
--Llewellyn
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!