<?php



include ('dbConnect.php');



$ui= $_POST['ui'];



if($ui=="getpages"){



	

	

	$usql = "SELECT * FROM `Pages` ORDER BY `ID` ASC";

	

	$result = mysqli_query($hookup, $usql);

	$cnt=0;

	$xml="<xml><data>";

	//$row = mysqli_fetch_assoc($result);

	while($row = mysqli_fetch_assoc($result)) {

		$xml.="<item><id>".$row['ID']."</id>";

		$xml.="<page><![CDATA[".$row['page']."]]></page>";

		$xml.="<title><![CDATA[".$row['title']."]]></title>";

		$xml.="<desc><![CDATA[".$row['desc']."]]></desc>";

		$xml.="</item>";

	}

	

	$xml.="</data></xml>";

	echo $xml;

	

	 

}else if($ui=="update"){



$desc = mysqli_real_escape_string($hookup, $_POST['desc']);

$title = mysqli_real_escape_string($hookup, $_POST['title']);

$id = intval($_POST['id']);

	

	$sql = "UPDATE `Pages` SET `desc` = '$desc', `title` = '$title' WHERE `ID` = '$id'";

	

	if(mysqli_query($hookup, $sql)){

		$return = "success";

		echo $return; 

	}else{

		$return = "error=" . $type. " / ". mysqli_error($hookup);

		echo $return; 

	 }

	 

}



?>