Changeset 17551


Ignore:
Timestamp:
02/13/14 14:25:25 (11 years ago)
Author:
tose
Message:
Modify implementation for loading previous data
File:
1 edited

Legend:

Unmodified
Added
Removed
  • schedule/Transaction/PreviousData.php

    r17549 r17551  
    11 <?php
    22//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'];
    67        $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        }
    1215        else {
    13       $prevday = date ('Y-m-d');
     16                $prevday = date('Y-m-d');
    1417        }
    15         echo $prevday;
     18        echo json_encode($prevday);
    1619?>
Note: See TracChangeset for help on using the changeset viewer.