Changeset 17422 for schedule/Transaction
- Timestamp:
- 01/03/14 09:23:03 (11 years ago)
- Location:
- schedule/Transaction
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
schedule/Transaction/insert.php
r16926 r17422 1 <?php2 // Build by: khristofer Usman3 //Modified by: Jaypee Tanio 4 // June 14,2013 1 <?php 2 //connect to the mysql 3 $db = mysql_connect('localhost', 'root', '') or die("Could not connect database"); 4 mysql_select_db('sandboxschedule', $db) or die("Could not select database"); 5 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 echo "<br />"; 15 $n_value = explode(",",$value); 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-1;$i++) 22 { 23 $n1 = $n_value[$i]; 24 $selectf = $select[$i]; 25 $measuref = $measure[$i]; 26 $dateTime=new DateTime($date." ".$Times[$i]); 27 $parsed_date = $dateTime->format('Y-m-d H:i:s'); 6 7 $GTimes=$_POST['GTime']; 8 $Source=$_POST['Source']; 9 $measure=$_POST['measure']; 10 $data=$_POST['Data']; 11 $Gdates = $_POST['GDate']; 12 $seq = $_POST['seq']; 28 13 29 mysql_query("INSERT INTO schedule VALUES('null','".$parsed_date."','".$UpdateDate."','".$measuref."','','".$n1."','".$selectf."','".$measuref."')"); 30 31 } 14 $date = new DateTime($Gdates.$GTimes); 15 $par=$date->format('Y-m-d H:i:s'); 16 $Timez = new DateTime($GTimes); 17 $part = $Timez->format('H:i:s'); 18 //database query 19 mysql_query("INSERT INTO schedule VALUES('null','".$par."','".$part."','".$seq."','','".$data."','".$Source."','".$measure."')"); 20 32 21 33 22 ?> -
schedule/Transaction/update.php
r16926 r17422 1 2 <?php 3 //Build by: khristofer Usman 4 //Modified by: Jaypee Tanio 5 // June 22,2013 6 include '../include/factdb.php'; 7 $Time =$_POST['Time']; 8 $SelectedSource = $_POST['Source']; 9 $SelectedMeasure = $_POST['measure']; 10 $limtex = count(explode(",",$SelectedSource)); 11 $Upd=$_POST['upd']; 12 $Upt=$_POST['upt']; 13 $value = $_POST['Data']; 14 $date = $_POST['Date']; 15 $n_value = explode(",",$value); 16 $Times = explode(",",$Time); 17 $select = explode(",",$SelectedSource); 18 $measure = explode(",",$SelectedMeasure); 19 //date_default_timezone_set('Asia/Manila'); // Setting up the localTimeZone in asia 20 $UpdateDate=(date('Y-m-d H:i:s')); 1 <?php 2 //connect to the mysql 3 $db = mysql_connect('localhost', 'root', '') or die("Could not connect database"); 4 mysql_select_db('sandboxschedule', $db) or die("Could not select database"); 21 5 22 6 23 $days = Date('Y-m-d',strtotime($date)); 7 $GTimes=$_POST['GTime']; 8 $Source=$_POST['Source']; 9 $measure=$_POST['measure']; 10 $data=$_POST['Data']; 11 $Gdates = $_POST['GDate']; 12 $seq = $_POST['seq']; 13 14 $date = new DateTime($Gdates.$GTimes); 15 $par=$date->format('Y-m-d H:i:s'); 16 $UpdateDate=(date('Y-m-d H:i:s')); 24 17 25 $fetch = mysql_query("SELECT * FROM schedule") or die(mysql_error()); 26 27 while($rows = mysql_fetch_array($fetch)) 28 { 29 $timestamp=strtotime($rows['fStart']); 30 $timestamp2 = date('Y-m-d',$timestamp); 31 $date_time = date('H:i',$timestamp); 32 //$time_new = $date_time->format('H:i:s') 33 if($days == $timestamp2) 34 { 35 36 $delete = mysql_query("DELETE FROM `schedule` WHERE `fStart`='{$rows['fStart']}'"); 18 $days = Date('Y-m-d',strtotime($Gdates)); 19 $cnt = 0; 20 //QUERY TO DELETE THE TABLE INSIDE THE DATABASE 21 //$fetch = mysql_query("SELECT * FROM schedule WHERE date(fStart)='$days'") or die(mysql_error()); 22 //while($rows = mysql_fetch_array($fetch)){ 23 //$update=mysql_query("UPDATE schedule SET `fStart`='$par',`fLastUpdate`='$UpdateDate',`fMeasurementID`='$seq',`fData`='$data',`fSourceKey`='$Source',`fMeasurementTypeKey`='$measure' WHERE fScheduleID = '".$rows['fSchecduleID']."' "); 24 25 //mysql_query("DELETE FROM schedule WHERE date(fStart)='".$rows['fStart']."'"); 26 mysql_query("INSERT INTO schedule VALUES('null','".$par."','".$UpdateDate."','".$seq."','','".$data."','".$Source."','".$measure."')"); 27 //} 37 28 38 } 39 } 40 41 42 for($i=0;$i<=$limtex-1;$i++) 43 { 44 $select = explode(",",$SelectedSource); 45 $n1 = $n_value[$i]; 46 $selectf = $select[$i]; 47 $measuref = $measure[$i]; 48 $dateTime=new DateTime($date." ".$Times[$i]); 49 $parsed_date = $dateTime->format('Y-m-d H:i:s'); 29 30 //$delete = mysql_query("DELETE FROM `schedule` WHERE `fStart`='{$rows['fStart']}'"); 31 //database query 50 32 51 mysql_query("INSERT INTO schedule VALUES('null','".$parsed_date."','".$UpdateDate."','".$measuref."','','".$n1."','".$selectf."','".$measuref."')");52 53 }54 33 ?>
Note:
See TracChangeset
for help on using the changeset viewer.