Welcome Guest, Not a member yet? Register   Sign In
Dynamic chart Date range to filter records with PHP MySQL
#6

(This post was last modified: 09-06-2023, 10:29 AM by ozornick. Edit Reason: Format code )

From the data recieved from the api, it contains a data with date '2017-02-28T00:00:00Z'; when you specify the start_date variable like this $sdate='2017-01-28T00:00:00Z'; and the end_date variable like this $edate='2017-02-28T00:00:00Z'; you get the data returned.

When you specify it like this $sdate='2017-01-28T00:00:00Z'; and the end date as this $edate='2017-03-28T00:00:00Z'; it bring out no data.


PHP Code:
$baseURL 'https://myip/DynamicsNAV90/WS/';
$pageURL $baseURL.rawurlencode($cur).'/Page/info';

$id='0101001';
$sdate='2017-01-28T00:00:00Z';
$edate='2017-03-28T00:00:00Z';
$error_msg=array("message"=>("Bill not found"));
//echo $sdate;
$params = array('filter' => array(
                                array('Field' => 'ID''Criteria' => $id),
                                array('Field' => 'Date''Criteria' => $sdate),
                                array('Field' => 'Date''Criteria' => $edate)
                                ),
                    'setSize' => 0);
$result $page->ReadMultiple($params);
$customers $result->ReadMultiple_Result->BillingInfo;

if ( 
$customers->Date >= $sdate && $customers->Date <=$edate)
{
    echo json_encode(array($customers));
}else{
    echo json_encode($error_msg);


what i'm trying to do is to search in between, i could have done this by writing a select statement on the database and specify the date ranges but since i'm only pulling from a web api its really difficult
Reply


Messages In This Thread
RE: Dynamic chart Date range to filter records with PHP MySQL - by AnneGodkoyj - 02-13-2023, 11:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB