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']))); } }