source: schedule/Transaction/insert.php@ 16914

Last change on this file since 16914 was 16914, checked in by tanio, 11 years ago
File size: 1.3 KB
Line 
1<?php
2//Build by: khristofer Usman
3//Modified by: Jaypee Tanio
4// June 14,2013
5
6include '../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);
15echo "<br />";
16$Times = explode(",",$Time);
17$select = explode(",",$SelectedSource);
18$measure = explode(",",$SelectedMeasure);
19$limtex = count(explode(",",$SelectedMeasure));
20echo "<br />";
21for($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?>
Note: See TracBrowser for help on using the repository browser.