source: schedule/Transaction/insert.php@ 16378

Last change on this file since 16378 was 16276, checked in by tanio, 12 years ago
File size: 1.8 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
31
32
33
34
35
36
37
38
39for($i=0;$i<=$limtex-1;$i++){
40$select = explode(",",$SelectedSource);
41 $n1 = $n_value[$i];
42
43 $selectf = $select[$i];
44 //////Time////
45 //$Timef = $Time[$i];
46
47 //////// for measurement /////////
48
49 $measuref = $measure[$i];
50
51 //////// Date parsing into format////////
52 $dateTime=new DateTime($date." ".$Times[$i]);
53 $parsed_date = $dateTime->format('Y-m-d H:i:s');
54
55
56 $select = mysql_query("SELECT * FROM schedule WHERE fLastUpdate = '$parsed_date'");
57 if($select){
58 while($row = mysql_fetch_array($select)){
59
60
61 $new = $row['fMeasurementID'] + 1 ;
62
63
64
65 }
66 }else{
67
68 $new = 0;
69
70 }
71
72 $insert = mysql_query("INSERT IGNORE INTO schedule values('','$parsed_date','$parsed_date','$new','','$n1','$selectf','$measuref')") or die(mysql_error());
73
74}
75 if($insert){
76
77 ?>
78 <script type="text/javascript">
79
80 alert("Sucessfully save");
81 window.location = '../index.php?<?php echo $TimeEX2; ?>';
82 </script>
83 <?php
84
85 }
86
87?>
Note: See TracBrowser for help on using the repository browser.