ok here my code
libxml_use_internal_errors(true);
$objXML = simplexml_load_file('MainRelease.xml','my_node'); // load xml file
if(!$objXML){
$errors = libxml_get_errors();
foreach($errors as $error)
{
echo $error->message,'<br />';
}
}
else
{
$Result = $objXML->xpath('AllRelease/Release/name[@rdate="'.$DATERELEASE.'"]');
if(empty($Result)){
$AllRelease = $objXML->xpath("//AllRelease");
$releas = $AllRelease[0]->prependChild2("Release");
$dat = $releas->prependChild2("name");
$dat->addAttribute("rdate",$DATERELEASE);
$releas->prependChild("comment",$COMMENT);
$Anime = $releas->prependChild2("Anime");
$Anime->prependChild("popup",$POPUP);
$Anime->prependChild("Title",$VIDEONAME);
$Anime->prependChild("VideoUrl",$dir);
$objXML->asXML("MainRelease.xml");
}else{
$Anime = $objXML->xpath("//Release");
$anime = $Anime[0]->addChild("Anime");
$anime->addChild("popup",$POPUP);
$anime->addChild("Title",$VIDEONAME);
$anime->addChild("VideoUrl",$dir);
$objXML->asXML("MainRelease.xml");
}
}
?>
The probleme is with this line
$Result = $objXML->xpath('AllRelease/Release/name[@rdate="'.$DATERELEASE.'"]');
its always return empty on any condition.
im trying to make a condition statement so if this line return true do this or if false do the other statement.
So any help will be appreciate its my first time working on xml xpath and simpleXML.