<?php

//Code to monitor changes in categories and menuitem 

$checkRecordQuery = "Select * from monitoring_changes where user_id = '".$_SESSION['UserID']."'";
$cResult = mysql_query($checkRecordQuery); 
if(mysql_num_rows($cResult) == 0){
	$setFlagQuery = "Insert into monitoring_changes (user_id,user_record_key,flag)
			 Values ('".$_SESSION['UserID']."' , '".$_SESSION['recordKey']."' , 1 )";
mysql_query($setFlagQuery);
}else{
	$updateFlagQuery = "Update monitoring_changes set flag=1 where user_id = '".$_SESSION['UserID']."'";
mysql_query($updateFlagQuery);
}