Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14941 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37497 invoked by uid 1010); 14 Feb 2005 23:40:59 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 37478 invoked from network); 14 Feb 2005 23:40:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Feb 2005 23:40:59 -0000 X-Host-Fingerprint: 68.157.246.80 mx1.distinctinnovations.com Windows 2000 SP4, XP SP1 Received: from ([68.157.246.80:1542] helo=distinctinnovations.com) by pb1.pair.com (ecelerity 1.2.11rc1 (r4431)) with SMTP id 5E/58-26408-B0731124 for ; Mon, 14 Feb 2005 18:40:59 -0500 Received: by distinctinnovations.com (Wildcat! SMTP Router v6.0.451.3) for internals@lists.php.net; Mon, 14 Feb 2005 18:42:57 -0500 Received: from ns2.distinctinnovations.com ([68.157.246.71]) EHLO=cl1823 by distinctinnovations.com (Wildcat! SMTP v6.0.451.3) with SMTP id 1120152303; Mon, 14 Feb 2005 18:42:55 -0500 Message-ID: <018b01c512ee$914c4ba0$71f69d44@setechusa.com> To: Date: Mon, 14 Feb 2005 18:40:29 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1478 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478 X-Antivirus-Remover: Message filtered with wsAV v2.0.0 Build 001 Subject: Extension DLL Objects From: chris.cranford@tkdsoftware.com ("Chris Cranford") I want to have a function that returns an object that essentially looks like the following: $user->name; // string that holds name of user $user->from; // string that holds where user is from $user->update(); // method that updates changed user data to db (**unsure how to code this) In my php script, I have defined a function "getuser" I call that returns this object. Here is a sample from my script: name." from ".$user->from; $user->from = "Nowhereville, USA"; $user->update(); // updates user record and saves to db ?> Is there any specific or standard way I should be creating this object? Right now my code looks like this: ZEND_FUNCTION(getuser) { TUser u; if(GetLoggedInUser(&u)) { if(object_init(return_value)==SUCCESS) { add_property_string(return_value,"name",u.Info.Name,1); add_property_string(return_value,"from",u.From,1); // need to add a reference to the update function here ?? // unclear how to do this. return; } } RETURN_NULL(); } And how do I go about adding that "update()" function to my object to handle a function call to commit the object changes to the database? Thanks Chris