Changeset 17551 for schedule/Transaction/PreviousData.php
- Timestamp:
- 02/13/14 14:25:25 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
schedule/Transaction/PreviousData.php
r17549 r17551 1 1 <?php 2 2 //connect to the mysql 3 include '../include/dbcon.php'; 4 $day=$_POST['SelectedDay']; 5 3 $db = mysql_connect("localhost","scheduletest","t3stsched"); 4 mysql_select_db('sandboxschedule', $db) or die("Could not select database"); 5 6 $day=$_POST['SelectedDay']; 6 7 $date = Date('Y-m-d', strtotime($day)); 7 $prev = mysql_query("SELECT Date(fStart) AS PrevDate FROM schedule WHERE (date(fStart) < $date) ORDER BY Date(fStart) DESC LIMIT 1"); 8 $prevdate = mysql_fetch_array($prev); 9 if(mysql_num_rows($prevdate) > 0) { 10 $prevday = date('Y-m-d', $prevdate['PrevDate']); 11 } 8 9 $prev = mysql_query("SELECT Date(fStart) AS PrevDate FROM schedule WHERE (Date(fStart) < '$date') ORDER BY Date(fStart) DESC LIMIT 1"); 10 $prevdate = mysql_fetch_array($prev); 11 12 if(mysql_num_rows($prev) > 0) { 13 $prevday = date('Y-m-d', strtotime($prevdate['PrevDate'])); 14 } 12 15 else { 13 $prevday = date('Y-m-d');16 $prevday = date('Y-m-d'); 14 17 } 15 echo $prevday;18 echo json_encode($prevday); 16 19 ?>
Note:
See TracChangeset
for help on using the changeset viewer.