Hello everyone . So i an issue with two arrays going into one url endpoint.
I have three properties
1. a url endpoint that accepts two query parameters $id and $$timestamp $apiUrl=”2. $Id is the id of different accounts in a database table3. $timestamp is a date range specified by users. This range starts from the current system time to a set enddate.
the api gets all activities of each account id based on the set timestamp.4. what i want now is how to get all activities of each account id based on the set timestamp5. i Know i will end up with two foreach loop. how do i loop through the date range of each ID
method to get time range
public function loopThroughRange($date2,$date1){
// echo $enddate;
$date2=date(‘Y-m-d H:i:s’);
if ( $date2 > $date1) {
$start = new DateTime($date2 );
$end = new DateTime($date1);
$diff = $end->diff($start);
$interval = DateInterval::createFromDateString(‘-1 day’);
$period = new DatePeriod($start, $interval, $diff->days)
foreach ($period as $date) {
return $date->format(‘y-m-d h:i:s’) . ‘<br>’; // or whatever you want to do
}
}
method to get all Account id from the database
public function getIndexID(){
$query=’ SELECT ‘.ACTIVE_ID.’ FROM ‘.ACTIVECURRENCY_TB.”;
$sth =$this->conn->prepare($query);
$sth->execute();
$indexId = $sth->fetchAll(PDO::FETCH_ASSOC);
return $indexId;
}