|
hw_Modifyobject(PHP 4) hw_Modifyobject — Modifies object record Описание
bool hw_modifyobject
( int $connection
, int $object_to_change
, array $remove
, array $add
[, int $mode
] )
This command allows to remove, add, or modify individual attributes of an object record. The object is specified by the Object ID object_to_change. In order to modify an attribute one will have to remove the old one and add a new one. hw_modifyobject() will always remove the attributes before it adds attributes unless the value of the attribute to remove is not a string or array. The keys of both arrays are the attributes name. The value of each array element can either be an array, a string or anything else. If it is an array each attribute value is constructed by the key of each element plus a colon and the value of each element. If it is a string it is taken as the attribute value. An empty string will result in a complete removal of that attribute. If the value is neither a string nor an array but something else, e.g. an integer, no operation at all will be performed on the attribute. This is necessary if you want to add a completely new attribute not just a new value for an existing attribute. If the remove array contained an empty string for that attribute, the attribute would be tried to be removed which would fail since it doesn't exist. The following addition of a new value for that attribute would also fail. Setting the value for that attribute to e.g. 0 would not even try to remove it and the addition will work. If you would like to change the attribute 'Name' with the current value 'books' into 'articles' you will have to create two arrays and call hw_modifyobject(). Пример #1 modifying an attribute
<?php Пример #2 adding a completely new attribute
<?php
Пример #3 modifying Title attribute
<?php Пример #4 modifying Title attribute
<?php Пример #5 removing attribute
<?php
Список параметров
Возвращаемые значенияВозвращает TRUE в случае успешного завершения или FALSE в случае возникновения ошибки. |
|