Index: /schedule/Transaction/insert.php
===================================================================
--- /schedule/Transaction/insert.php	(revision 16099)
+++ /schedule/Transaction/insert.php	(revision 16100)
@@ -11,6 +11,6 @@
 $TimeEX = explode("-",$Date);
 
-echo $TimeEX2 = "day=".$TimeEX[0]."&month=".$TimeEX[1]."&year=".$TimeEX[2];
-echo $limtex = count(explode(",",$SelectedSource));
+$TimeEX2 = "day=".$TimeEX[0]."&month=".$TimeEX[1]."&year=".$TimeEX[2];
+ $limtex = count(explode(",",$SelectedSource));
 $insertdate = $TimeEX[2]."-".$TimeEX[1]."-".$TimeEx[0];
 $value = $_GET['Data'];
@@ -27,55 +27,24 @@
 $temp = "";
 $insert_count = 0;
+	
+$new_limit = $limtex;
 
 
 
-/////// for measurement id///////		
-$new_limit = $limtex;
-						for($j=0;$j<=$new_limit-1;$j++){
+						for($j=0;$j <= $new_limit;$j++){
 
-							echo $Times[$j];
-							echo "sgsdgdsg";
+							//echo $Times[$j];
+							
 							$ex_counter = explode(":",$Times[$j]);
 					
 							$counter[$j] = $ex_counter[0];
+							
+							
+							
+							
 									
 						}
-									echo "<br />";
-						if($new_limit > 0){
-							for($j=0;$j<=$new_limit;$j++){		
-									
-								for($y=0;$y<=$new_limit;$y++){
-									if($y > 0){
-										if($counter[$j]==$counter[$y]){
-										
-											if(empty($by_count[$y]) || $by_count[$y] == 0){
-									
-												$by_count[$y] = $y;
-											}else{
-											
-												 $by_count[$y] = 0;
-											}
-										}
-									}else{
-									
-									
-									$by_count[$y] = 0;
-									
-									
-									}
-									
-								}
-							}	
-									
-						}else{
-									
-									
-							$by_count[0]=0;
-									
-						}
-					
-
-					
-					
+				
+	
 					
 
@@ -94,12 +63,26 @@
 				//////// Date parsing into format////////
 						$dateTime=new DateTime($date." ".$Times[$i]);
-						echo $parsed_date =  $dateTime->format('Y-m-d H:i:s');
-						echo "<br />";
-						echo $by_count[$i]."----".$counter[$i];
-						echo "<br />";
+						 $parsed_date =  $dateTime->format('Y-m-d H:i:s');
 						
+					
+			// $select = mysql_query("SELECT * FROM schedule WHERE fLastUpdate = '$parsed_date'");
+			// if($select){
+			// while($row = mysql_fetch_array($select)){
+		
+				
+				// $new =   $row['fMeasurementID'] + 1 ;
+				
 			
-		//$insert = mysql_query("INSERT INTO schedule values('','$parsed_date','$parsed_date','','','$n1','$selectf','$measuref')") or die(mysql_error());
+			
+			// }
+				// }else{
 				
+				// $new = 0;
+				
+				// }	
+				//echo $new."<br />";
+			
+		$insert = mysql_query("INSERT INTO schedule values('','$parsed_date','$parsed_date','','','$n1','$selectf','$measuref')ON DUPLICATE KEY UPDATE fMeasurementID=fMeasurementID + 1") or die(mysql_error());
+					
 }
  if($insert){
@@ -109,5 +92,5 @@
 				   
 					alert("Sucessfully save");
-				//	window.location = '../index.php?<?php echo $TimeEX2; ?>';
+					window.location = '../index.php?<?php echo $TimeEX2; ?>';
 				</script>
 				<?php
