source: schedule/Transaction/insert.php@ 16070

Last change on this file since 16070 was 16070, checked in by tanio, 12 years ago
File size: 2.5 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
13echo $TimeEX2 = "day=".$TimeEX[0]."&month=".$TimeEX[1]."&year=".$TimeEX[2];
14echo $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
31
32/////// for measurement id///////
33$new_limit = $limtex;
34 for($j=0;$j<=$new_limit-1;$j++){
35
36 echo $Times[$j];
37 echo "sgsdgdsg";
38 $ex_counter = explode(":",$Times[$j]);
39
40 $counter[$j] = $ex_counter[0];
41
42 }
43 echo "<br />";
44 if($new_limit > 0){
45 for($j=0;$j<=$new_limit;$j++){
46
47 for($y=0;$y<=$new_limit;$y++){
48 if($y > 0){
49 if($counter[$j]==$counter[$y]){
50
51 if(empty($by_count[$y]) || $by_count[$y] == 0){
52
53 $by_count[$y] = $y;
54 }else{
55
56 $by_count[$y] = 0;
57 }
58 }
59 }else{
60
61
62 $by_count[$y] = 0;
63
64
65 }
66
67 }
68 }
69
70 }else{
71
72
73 $by_count[0]=0;
74
75 }
76
77
78
79
80
81
82for($i=0;$i<=$limtex-1;$i++){
83
84 $n1 = $n_value[$i];
85 $select[$i];
86 $selectf = $select[$i];
87 //////Time////
88 //$Timef = $Time[$i];
89
90 //////// for measurement /////////
91
92 $measuref = $measure[$i];
93
94 //////// Date parsing into format////////
95 $dateTime=new DateTime($date." ".$Times[$i]);
96 echo $parsed_date = $dateTime->format('Y-m-d H:i:s');
97 echo "<br />";
98 echo $by_count[$i]."----".$counter[$i];
99 echo "<br />";
100
101
102 //$insert = mysql_query("INSERT INTO schedule values('','$parsed_date','$parsed_date','','','$n1','$selectf','$measuref')") or die(mysql_error());
103
104}
105 if($insert){
106
107 ?>
108 <script type="text/javascript">
109
110 alert("Sucessfully save");
111 // window.location = '../index.php?<?php echo $TimeEX2; ?>';
112 </script>
113 <?php
114
115 }
116
117?>
Note: See TracBrowser for help on using the repository browser.