1 Insert
Shikiryu edited this page 2019-10-21 09:40:05 +02:00

There's 1 way to Insert items into the XMLDB:

Insert Items

Syntax: public function insertItem($id = null, $attributes = null, $childs = null, $table)

Example:

$xmldb = new XMLDB('db.xml');
$xmldb->insertItem('test', array('name'=>'alright'), array('visibility'=>'true', 'x'=>'33'), 'table1')

This will insert the following item into table1 $id can now be null and must be null if you use autoincrement. It will return false otherwise.

    <item id="test" name="alright">
        <visibility>true</visibility>
        <x>33</x>
    </item>