source: schedule/Transaction/insert.php@ 16064

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