diff --git a/Update.md b/Update.md new file mode 100644 index 0000000..975b93a --- /dev/null +++ b/Update.md @@ -0,0 +1,32 @@ +We offered you 2 ways to `Update` items into the XMLDB: + +## Update attribute + +*Syntax:* `public function updateNodeAttribute($table, $oldAttribute, $newAttribute, $forceInsert = false)` + +*Params:* + +`$table` : String : name of the table +`$oldAttribute` : Array : name of the actual attribute of the element (it will find the element thanks to it...) +`$newAttribute` : Array : same but new +`$forceInsert` : boolean : if the attribute doesn't exist do we create it ? + +*Example:* + +```php +$xmldb = new XMLDB('db.xml'); +$xmldb->updateNodeAttribute('table1', array('id', 'links'), array('id', 'zelda')); +``` + +## Update child value + +*Syntax:* `public function updateNodeValue($table, $attribute = null, $child = null, $value)` + +*Example:* + +```php +$xmldb = new XMLDB('db.xml'); +$xmldb->updateNodeValue('table1', array('id', 'notes'), null, 'booga!'); +``` + +Note : Like in the example, you can also change the item value *but it will erase all children in the process* \ No newline at end of file