source: schedule/Transaction/insert.php@ 16112

Last change on this file since 16112 was 16112, checked in by tanio, 12 years ago
File size: 2.1 KB
Line 
1<?php
2include '../include/factdb.php';
3
4
5
6 $Time =$_GET['Time'];
7 $SelectedSource = $_GET['Source'];
8 $Date = $_GET['Date'];
9
10 $SelectedMeasure = $_GET['measure'];
11$TimeEX = explode("-",$Date);
12
13$TimeEX2 = "day=".$TimeEX[0]."&month=".$TimeEX[1]."&year=".$TimeEX[2];
14 $limtex = count(explode(",",$SelectedSource));
15$insertdate = $TimeEX[2]."-".$TimeEX[1]."-".$TimeEx[0];
16$value = $_GET['Data'];
17$Date = $_GET['Date2'];
18//$date = new DateTime($_GET['Date']);
19$n_value = explode(",",$value);
20echo "<br />";
21//echo $date->format('Y-m-d H:i:s');
22//fdgdfgdf
23 $Times = explode(",",$Time);
24$select = explode(",",$SelectedSource);
25$measure = explode(",",$SelectedMeasure);
26echo "<br />";
27$temp = "";
28$insert_count = 0;
29
30$new_limit = $limtex;
31
32
33
34 for($j=0;$j <= $new_limit;$j++){
35
36 //echo $Times[$j];
37
38 $ex_counter = explode(":",$Times[$j]);
39
40 $counter[$j] = $ex_counter[0];
41
42
43
44
45
46 }
47
48
49
50
51for($i=0;$i<=$limtex-1;$i++){
52
53 $n1 = $n_value[$i];
54 $select[$i];
55 $selectf = $select[$i];
56 //////Time////
57 //$Timef = $Time[$i];
58
59 //////// for measurement /////////
60
61 $measuref = $measure[$i];
62
63 //////// Date parsing into format////////
64 $dateTime=new DateTime($date." ".$Times[$i]);
65 $parsed_date = $dateTime->format('Y-m-d H:i:s');
66
67
68 $select = mysql_query("SELECT * FROM schedule WHERE fLastUpdate = '$parsed_date'");
69 if($select){
70 while($row = mysql_fetch_array($select)){
71
72
73 $new = $row['fMeasurementID'] + 1 ;
74
75
76
77 }
78 }else{
79
80 $new = 0;
81
82 }
83 //echo $new."<br />";
84
85 $insert = mysql_query("INSERT IGNORE INTO schedule values('','$parsed_date','$parsed_date','$new','','$n1','$selectf','$measuref')") or die(mysql_error());
86
87}
88 if($insert){
89
90 ?>
91 <script type="text/javascript">
92
93 alert("Sucessfully save");
94 window.location = '../index.php?<?php echo $TimeEX2; ?>';
95 </script>
96 <?php
97
98 }
99
100?>
Note: See TracBrowser for help on using the repository browser.