I am having a bit of difficulty. I have an XML database, in which information about users is stored on a website in such a format...
: ***** represents data
Code:
What I want to do is delete an entire <job> node out of this file. The problem is... the actual <job> node being deleted is variable. It could be the first, the second, or any one after that. Here is what i have so far.
The script that is going to do the deletion is within a file called actionscript.php. I send data to the file by calling this URL.
Code:
And in the PHP script
Code:
: ***** represents data
Code:
<user>
<password>*****</password>
<email>***** </email>
<tutorial> ***** </tutorial>
<team> ***** <team>
<canreview> ***** </canreview>
<joblist>
<job>
<date> ***** </date>
<type> ***** </type>
</job>
<job>
<date> ***** </date>
<type> ***** </type>
</job>
</joblist>
</users>
What I want to do is delete an entire <job> node out of this file. The problem is... the actual <job> node being deleted is variable. It could be the first, the second, or any one after that. Here is what i have so far.
The script that is going to do the deletion is within a file called actionscript.php. I send data to the file by calling this URL.
Code:
<a href="actionscript.php?action=deletenode&user=' . $_SESSION['username'] . '&node=' . $node . '">';
And in the PHP script
Code:
$action = $_GET['action'];
$user = $_GET['user'];
$node = $_GET['node'];
... some php code
if($action == 'deleteuser') {
$xml = //file is at 'user/' . $_SESSION['username'] . '.xml'
// and here begins my problems
// 1. I want to use Simple XML, but Simple XML can't delete nodes.
// That leaves me with DOM Document
// how do i use dom doc? I've really always used Simple XML and, till now, its served my needs.
// the tutorials i've found online don't help me with this particular usage..
}