parent
f3130bbe1d
commit
9bb3d9569c
32
Update.md
Normal file
32
Update.md
Normal file
@ -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*
|
Loading…
Reference in New Issue
Block a user