Last change
on this file since 20063 was 17551, checked in by tose, 11 years ago |
Modify implementation for loading previous data
|
File size:
644 bytes
|
Line | |
---|
1 | <?php
|
---|
2 | //connect to the mysql
|
---|
3 | $db = mysql_connect("localhost","scheduletest","t3stsched");
|
---|
4 | mysql_select_db('sandboxschedule', $db) or die("Could not select database");
|
---|
5 |
|
---|
6 | $day=$_POST['SelectedDay'];
|
---|
7 | $date = Date('Y-m-d', strtotime($day));
|
---|
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 | }
|
---|
15 | else {
|
---|
16 | $prevday = date('Y-m-d');
|
---|
17 | }
|
---|
18 | echo json_encode($prevday);
|
---|
19 | ?>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.