1 | <?php
|
---|
2 | //Build by: khristofer Usman
|
---|
3 | //Modified by: Jaypee Tanio
|
---|
4 | // June 14,2013
|
---|
5 |
|
---|
6 | include '../include/factdb.php';
|
---|
7 | $Time =$_POST['Time'];
|
---|
8 | $SelectedSource = $_POST['Source'];
|
---|
9 | $Date = $_POST['Date'];
|
---|
10 | echo $Date;
|
---|
11 | $SelectedMeasure = $_POST['measure'];
|
---|
12 | $value = $_POST['Data'];
|
---|
13 | $date = $_POST['Date'];
|
---|
14 | $n_value = explode(",",$value);
|
---|
15 | echo "<br />";
|
---|
16 | $Times = explode(",",$Time);
|
---|
17 | $select = explode(",",$SelectedSource);
|
---|
18 | $measure = explode(",",$SelectedMeasure);
|
---|
19 | $limtex = count(explode(",",$SelectedMeasure));
|
---|
20 | echo "<br />";
|
---|
21 | for($i=0;$i<=$limtex;$i++)
|
---|
22 | {
|
---|
23 | $select = explode(",",$SelectedSource);
|
---|
24 | $n1 = $n_value[$i];
|
---|
25 | $selectf = $select[$i];
|
---|
26 | //////// for measurement /////////
|
---|
27 | $measuref = $measure[$i];
|
---|
28 | //////// Date parsing into format////////
|
---|
29 | $dateTime=new DateTime($date." ".$Times[$i]);
|
---|
30 | $parsed_date = $dateTime->format('Y-m-d H:i:s');
|
---|
31 | $new = 0;
|
---|
32 |
|
---|
33 | $select = mysql_query("SELECT * FROM schedule WHERE fLastUpdate = '$parsed_date'");
|
---|
34 | if($select)
|
---|
35 | {
|
---|
36 | while($row = mysql_fetch_array($select))
|
---|
37 | {
|
---|
38 | $new = $row['fMeasurementID'] + 1 ;
|
---|
39 | }
|
---|
40 | }
|
---|
41 | else
|
---|
42 | {
|
---|
43 | $new = 0;
|
---|
44 | }
|
---|
45 | $insert = mysql_query("INSERT INTO schedule values('','$parsed_date','$parsed_date','$measuref','','$n1','$selectf','$measuref')") or die(mysql_error());
|
---|
46 |
|
---|
47 |
|
---|
48 |
|
---|
49 | }
|
---|
50 |
|
---|
51 | ?> |
---|