From 9bb3d9569cba0266e9e0a3477b7bfc03edce3b41 Mon Sep 17 00:00:00 2001 From: Shikiryu Date: Mon, 21 Oct 2019 09:46:28 +0200 Subject: [PATCH] --- Update.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Update.md 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