| 123456789101112131415161718192021222324252627282930 |
- <?php
- $swapsSql = "SELECT *,
- user.DEID,
- swap.CreatedAt AS SwapCreatedAt,
- swap.UpdatedAt AS SwapUpdatedAt
- FROM swap swap
- JOIN rider rider ON rider.RiderID=swap.RiderID
- JOIN user user ON user.UserID=rider.UserID
- WHERE swap.IsActive='1' $swapSqlfilter";
- $swapsRes = mysqli_query($conn, $swapsSql);
- if ($swapsRes->num_rows > 0) {
- $id = 0;
- foreach ($swapsRes as $swaprow) {
- $id++;
- $swaps = array_merge($swaps, array(array($id, $swaprow['RiderID'], $swaprow['DEID'], $swaprow['ReturnBatterID'], $swaprow['SwappedBatterID'], $swaprow['IsFreeSwap'], $swaprow['SwapCreatedAt'], $swaprow['SwapUpdatedAt'])));
- }
- }
- $swapCountSql = "SELECT swap.CreatedDate, count(swap.SwapID) AS ContData
- from swap swap
- WHERE swap.IsActive='1' $swapCountSqlfilter
- GROUP BY swap.CreatedDate";
- $swapCountRes = mysqli_query($conn, $swapCountSql);
- if ($swapCountRes->num_rows > 0) {
- $id = 0;
- foreach ($swapCountRes as $swapCountrow) {
- $id++;
- $swapCount = array_merge($swapCount, array(array($id, $swapCountrow['CreatedDate'], $swapCountrow['ContData'])));
- }
- }
|