i'm trying to remove a child node from an xml. my script is working..but it removing a few childs... and not just the one i want to remove...
bakmak ve benim sorunum ne söyleyebilir?
The XML file:
<?xml version="1.0" encoding="UTF-8" ?> 
<events>
   <record>
      <id>3</id> 
   </record>
   <record>
      <id>2</id> 
   </record>
   <record>
      <id>1</id> 
   </record>
 </events>
The delete.php file:
<?php
header("Content-type: text/html; charset=utf-8");
$record = array(
    'id' => $_POST['id'],
);
$users = new DOMDocument();
$users->load("xmp.xml");
$suser = simplexml_load_file("xmp.xml");
$count = 0;
$user = $users->getElementsByTagName("record");
foreach($user as $value)
{
   $tasks = $value->getElementsByTagName("id");
   $task  = $tasks->item(0)->nodeValue;
   if ($task == $record["id"]) {
    $users->documentElement->removeChild($users->documentElement->childNodes->item($count));
   }
   $count++;
}
$users->save("xmp.xml");
?>
