Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14951 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53387 invoked by uid 1010); 15 Feb 2005 02:24:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 53330 invoked from network); 15 Feb 2005 02:24:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Feb 2005 02:24:49 -0000 X-Host-Fingerprint: 68.157.246.80 mx1.distinctinnovations.com Windows 2000 SP4, XP SP1 Received: from ([68.157.246.80:2966] helo=distinctinnovations.com) by pb1.pair.com (ecelerity 1.2.11rc1 (r4431)) with SMTP id EA/71-26408-07D51124 for ; Mon, 14 Feb 2005 21:24:48 -0500 Received: by distinctinnovations.com (Wildcat! SMTP Router v6.0.451.3) for internals@lists.php.net; Mon, 14 Feb 2005 21:26:42 -0500 Received: from ns2.distinctinnovations.com ([68.157.246.71]) EHLO=cl1823 by distinctinnovations.com (Wildcat! SMTP v6.0.451.3) with SMTP id 1129976940; Mon, 14 Feb 2005 21:26:40 -0500 Message-ID: <039d01c51305$703a99a0$71f69d44@setechusa.com> To: "Alan Knowles" Cc: References: <018b01c512ee$914c4ba0$71f69d44@setechusa.com> <1108433355.18946.91.camel@alan> Date: Mon, 14 Feb 2005 21:24:12 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" 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: Re: [PHP-DEV] Extension DLL Objects From: chris.cranford@tkdsoftware.com ("Chris Cranford") 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 > >