Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14952 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65492 invoked by uid 1010); 15 Feb 2005 02:37:08 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 65477 invoked from network); 15 Feb 2005 02:37:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Feb 2005 02:37:08 -0000 X-Host-Fingerprint: 202.81.246.113 246-113.netfront.net Received: from ([202.81.246.113:58298] helo=newweb.akbkhome.com) by pb1.pair.com (ecelerity 1.2.11rc1 (r4431)) with SMTP id F0/42-26408-25061124 for ; Mon, 14 Feb 2005 21:37:08 -0500 Received: from [192.168.0.40] (helo=oxfam.localhost ident=alan) by newweb.akbkhome.com with esmtp (Exim 4.44) id 1D0sbn-0000rm-Eo; Tue, 15 Feb 2005 10:38:40 +0800 To: Chris Cranford Cc: internals@lists.php.net In-Reply-To: <039d01c51305$703a99a0$71f69d44@setechusa.com> References: <018b01c512ee$914c4ba0$71f69d44@setechusa.com> <1108433355.18946.91.camel@alan> <039d01c51305$703a99a0$71f69d44@setechusa.com> Content-Type: text/plain Date: Tue, 15 Feb 2005 10:38:26 +0800 Message-ID: <1108435106.18946.97.camel@alan> Mime-Version: 1.0 X-Mailer: Evolution 2.0.3 Content-Transfer-Encoding: 7bit X-ACL-Warn: "cleared badlog" Subject: Re: [PHP-DEV] Extension DLL Objects From: alan@akbkhome.com (Alan Knowles) Midgard code is probably the one to look at, but the object code in PHP5 is alot easier to work with. Regards Alan On Mon, 2005-02-14 at 21:24 -0500, Chris Cranford wrote: > And I should also mention I'm trying to do this for PHPv4 and not v5. > I'm not sure if that affects how the coding is done or not as I'm > quite new to all this. > > ----- Original Message ----- > From: "Alan Knowles" > To: "Chris Cranford" > Cc: > Sent: Monday, February 14, 2005 9:09 PM > Subject: Re: [PHP-DEV] Extension DLL Objects > > > > have a look at dbdo in cvs.php.net/pecl/dbdo, or look at the source for > > the midgard php extension, both of them do this. > > > > Regards > > Alan > > > > On Mon, 2005-02-14 at 18:40 -0500, Chris Cranford wrote: > > > 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: > > > > > > > > $user = getuser(); > > > echo "Your username is ".$user->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 > > > > > -- > > Alan Knowles > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- Alan Knowles