Newbie Question - Updating Object Properties in the Hash
| From: | fademail at mindspring dot com | Date: | Mon, 01 May 2000 14:42:34 +0000 |
| Subject: | Newbie Question - Updating Object Properties in the Hash | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-18321@lists.php.net to get a copy of this message | ||
I am new to php development and am having the following problem -
I have a function which is registered as a method for an object. In this method I am attempting to
update a property of the object but can't seem to get it working right. Here is what I am
doing:
I add the string property and the method to the object in the function that serves as a constructor
like this:
object_init(return_value);
add_property_string(return_value, "m_cPrefValue", value->value.str.val,1);
add_method(return_value, "getuserpreference", PHP3_GetUserPreference);
return;
In the getuserpreference method I then need to store a new value for the property m_cPrefValue so I
try this:
pval * cPrefValue;
getThis(&id);
_php3_hash_update(id->value.ht, "m_cPrefValue", sizeof("m_cPrefValue"),
"newstring" , sizeof("newstring"), (void **)&cPrefValue);
But that doesn't change the value in the hash because when I then access the property in the
php script - i get the unupdated value.
I am able to get the property from within the function using:
_php3_hash_find(id->value.ht,"m_cPrefValue", sizeof("m_cPrefValue"),(void
**)&cPrefValue);
If anyone could let me know what I am doing wrong I would very much appreciate it. Thanks
Daniel Swanson