1 | <?php
|
---|
2 | include '../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);
|
---|
20 | echo "<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);
|
---|
26 | echo "<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 |
|
---|
51 | for($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 INTO schedule values('','$parsed_date','$parsed_date','','','$n1','$selectf','$measuref')ON DUPLICATE KEY UPDATE fMeasurementID=fMeasurementID + 1") 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 | ?> |
---|