manu555 0 Newbie Poster

xml file

<?xml version="1.0"?>
<tiltviewergallery>
	<photos>	
	<photo id="10" imageurl="images/logo/cb0dc425946c764543897decab7cca56.jpg" linkurl="gallery.php?id=2&amp;gid=10"><title>ascsaas</title><description>sacsac</description></photo>
	<photo id="11" imageurl="images/logo/1896949a52b7685ebec8bc01862d6d68.jpg" linkurl="gallery.php?id=5&amp;gid=14"><title>sssa</title><description>sassa</description></photo>
	</photos>
</tiltviewergallery>

php code

$sql = "SELECT `id` FROM  `galleryimg` WHERE `id`=$id";
	$result = dbQuery($sql);
	$row = dbFetchAssoc($result);
	
	//$linkurl = 'gallery.php?id='.$row['id'];
	//$imageurl = 'imgs/'.$catImage;
	global $srvRoot;
	if (file_exists($srvRoot.'gallery.xml')) {	    
		$tiltviewergallery = simplexml_load_file($srvRoot.'gallery.xml');	
		foreach($tiltviewergallery->photos->photo as $photo)
		{		
			if( isset($photo['id']) && (int)$photo['id']===(int)$id){
		    unset ($photo['imageurl']);
			 unset ($photo['linkurl']);
			 unset ($photo->title);
			 unset ($photo->description) ; 
			}
		}
		
	} else {
		exit('Failed delete content in frontpage flash.');
	}

i am unable to delete node from xml file using this code
please help me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.