Trying to create a blank application REST API

I am trying to create a webservice. Used Blank Application. Code copy paste below. I have deployed this in a local XAMPP on my laptop. When I try to run from a browser I get the data (I am trying to query a table ). But I am not getting the same from POSTMAN
Code :

header(‘Access-Control-Allow-Origin: *’);
header(‘Content-Type: application/json’);

$data_arr = array();
$data_arr[‘data’] = array();

$check_sql = ‘SELECT * from products’;

sc_select(rs, $check_sql);

if (false == {rs})
{

// set response code - 404 Not found
http_response_code(404);
echo json_encode(array(‘message’ => ‘Error while accessing database.’));
}
else
{
while(!$rs->EOF)
{
$id = $rs->fields[0];
$name=$rs->fields[1];
$description=$rs->fields[2];
$price=$rs->fields[3];
$category_id=$rs->fields[4];
$category_name = $rs->fields[5];

$post_item = array(
“id” => $id,
“name” => $name,
“description” => html_entity_decode($description),
“price” => $price,
“category_id” => $category_id,
“category_name” => $category_name
);

array_push ($data_arr[‘data’], $post_item);

$rs->MoveNext();
}
$rs->Close();
// set response code - 200 OK
http_response_code(200);
echo json_encode($data_arr);
}

In the Microsoft Edge Browser (NOTE Chrome takes almost a minute for the fist instance) http://localhost:9090/scapi/readproducts/readproducts.php
following data is returned
[LEFT]{“data”:[{“id”:“1”,“name”:“LG P880 4X HD”,“description”:“My first awesome phone!”,“price”:“336”,“category_id”:“3”,“category_ name”:“2014-06-01 01:12:26”},{“id”:“2”,“name”:“Google Nexus 4”,“description”:“The most awesome phone of 2013!”,“price”:“299”,“category_id”:“2”,“category_n ame”:“2014-06-01 01:12:26”},{“id”:“3”,“name”:“Samsung Galaxy S4”,“description”:“How about no?”,“price”:“600”,“category_id”:“3”,“category_nam e”:“2014-06-01 01:12:26”},{“id”:“6”,“name”:“Bench Shirt”,“description”:“The best shirt!”,“price”:“29”,“category_id”:“1”,“category_n ame”:“2014-06-01 01:12:26”},{“id”:“7”,“name”:“Lenovo Laptop”,“description”:“My business partner.”,“price”:“399”,“category_id”:“2”,“categor y_name”:“2014-06-01 01:13:45”},{“id”:“8”,“name”:“Samsung Galaxy Tab 10.1”,“description”:“Good tablet.”,“price”:“259”,“category_id”:“2”,“category name":“2014-06-01 01:14:13”},{“id”:“9”,“name”:“Spalding Watch”,“description”:“My sports watch.”,“price”:“199”,“category_id”:“1”,"category name”:“2014-06-01 01:18:36”},{“id”:“10”,“name”:“Sony Smart Watch”,“description”:“The coolest smart watch!”,“price”:“300”,“category_id”:“2”,“category_ name”:“2014-06-06 17:10:01”},{“id”:“11”,“name”:“Huawei Y300”,“description”:“For testing purposes.”,“price”:“100”,“category_id”:“2”,“catego ry_name”:“2014-06-06 17:11:04”},{“id”:“12”,“name”:“Abercrombie Lake Arnold Shirt”,“description”:“Perfect as gift!”,“price”:“60”,“category_id”:“1”,“category_na me”:“2014-06-06 17:12:21”},{“id”:“13”,“name”:“Abercrombie Allen Brook Shirt”,“description”:“Cool red shirt!”,“price”:“70”,“category_id”:“1”,“category_n ame”:“2014-06-06 17:12:59”},{“id”:“26”,“name”:“Another product”,“description”:“Awesome product!”,“price”:“555”,“category_id”:“2”,“categor y_name”:“2014-11-22 19:07:34”},{“id”:“28”,“name”:“Wallet”,"description ":“You can absolutely use this one!”,“price”:“799”,“category_id”:“6”,“category_na me”:“2014-12-04 21:12:03”},{“id”:“31”,“name”:“Amanda Waller Shirt”,“description”:“New awesome shirt!”,“price”:“333”,“category_id”:“1”,“category_ name”:“2014-12-13 00:52:54”},{“id”:“42”,“name”:“Nike Shoes for Men”,“description”:“Nike Shoes”,“price”:“12999”,“category_id”:“3”,“category name":“2015-12-12 06:47:08”},{“id”:“48”,“name”:“Bristol Shoes”,“description”:“Awesome shoes.”,“price”:“999”,“category_id”:“5”,"category name”:“2016-01-08 06:36:37”},{“id”:“60”,“name”:“Rolex Watch”,“description”:“Luxury watch.”,“price”:“25000”,“category_id”:“1”,“categor y_name”:“2016-01-11 15:46:02”}]}

IN POSTMAN WITH SAME ADDRESS[/LEFT]

<style type=“text/css”>.scButton_default { font-family: Tahoma, Arial, sans-serif;box-sizing: border-box;; font-size: 13px; color: #3C4858; font-weight: normal; background-color: #FFFFFF; border-style: solid; border-width: 1px; padding: 0 12px !important; }.scButton_disabled { font-family: Tahoma, Arial, sans-serif;box-sizing: border-box;; font-size: 13px; color: #7d7d7d; font-weight: normal; background-color: #FFFFFF; border-style: solid; border-width: 1px; padding: 0 12px; }.scButton_group { font-family: Tahoma, Arial, sans-serif;box-sizing: border-box;; font-size: 13px; color: #3C4858; font-weight: normal; background-color: #FFFFFF; border-style: solid; border-width: 1px; padding: 7.8px 15px;margin:0px -5px !important; }.scButton_groupdisabled { font-family: Tahoma, Arial, sans-serif;box-sizing: border-box;; font-size: 13px; color: #7d7d7d; font-weight: normal; background-color: #FFFFFF; border-style: solid; border-width: 1px; padding: 7.8px 15px;margin:0px -5px !important; }.scButton_groupfirst { font-family: Tahoma, Arial, sans-serif;box-sizing: border-box;; font-size: 13px; color: #3C4858; font-weight: normal; background-color: #FFFFFF; border-style: solid; border-width: 1px; padding: 7.8px 15px; }.scButton_grouplast { font-family: Tahoma, Arial, sans-serif;box-sizing: border-box;; font-size: 13px; color: #3C4858; font-weight: normal; background-color: #FFFFFF; border-style: solid; border-width: 1px; padding: 0 12px; }.scButton_onmousedown { font-family: Tahoma, Arial, sans-serif;box-sizing: border-box;box-shadow: inset 0 1px 0 rgba(31, 45, 61, 0.15);; font-size: 13px; color: #FFFFFF; font-weight: normal; background-color: #1B8FC8;}.scButton_default:active img{filter: brightness(2)}.scButton_default:active{; border-style: solid; border-width: 1px; padding: 8px 10px; }.scButton_onmouseover { font-family: Tahoma, Arial, sans-serif;box-sizing: border-box;box-shadow: inset 0 -1px 0 rgba(31, 45, 61, 0.15);; font-size: 13px; color: #FFFFFF; font-weight: normal; background-color: #1B8FC8;}.scButton_default:hover img, .scButton_groupfirst:hover img, .scButton_group:hover img{filter: brightness(2);}.scButton_default:hover{; border-style: solid; border-width: 1px; padding: 8px 10px; }.scButton_small { font-family: Tahoma, Arial, sans-serif;box-sizing: border-box;; font-size: 13px; color: #3C4858; font-weight: normal; background-color: #FFFFFF; border-style: solid; border-width: 1px; padding: 3px 13px !important; }.scLink_default { text-decoration: underline; font-size: 13px; color: #1a0dab; }.scLink_default:visited { text-decoration: underline; font-size: 13px; color: #660099; }.scLink_default:active { text-decoration: underline; font-size: 13px; color: #1a0dab; }.scLink_default:hover { text-decoration: underline; font-size: 13px; color: #1a0dab; }</style>
<table width=“80%” border=“1” height=“117”>
<tr>
<td bgcolor="">
<b>
<font size=“4”>The database connection was not found, contact the system administrator. Connection:</font> conn_mysql
</b>
</td>
</tr>
</table>
<input type=“button” id=“sai” onClick=“window.location=’’; return false” class=“scButton_default” value="" title="" style=“vertical-align: middle;”>

Can you please help what could be the problem.

Thanks in advance

I haven’t got Edge running here, nor am I able to access your “localhost” link, so I can’t fully check the details. But, be sure there is no output whatsoever before you start calling PHP header(); functions. Different browsers tend to handle header and/or JSON data a bit different and Microsoft having quite te reputation for being the odd duck when it comes to handling things Chrome and/or Firefox aren’t even bothered by. There’s a few things you can do to debug:

  • Use a tool like cURL (on OSX through the commandline, Windows must have it in another way) to see what the HTTP headers are, this tells the browser how/what to do with data. [LIST]
  • Compare your HTTP headers with any other JSON/API source, to see what is different
  • Validate the output of the JSON with a JSON validator, you should be able to find dozens with a little Googling. [/LIST] On a sidenote; to make it easier for other users to comprehend your issue - please use the CODE / PHP tags on the forum.
    
    <!-- because this is much easier to read -->
    
    
  • Thanks to all. I got it working. The issue with postman is resolved

    post your solution plz

    Sorry. Just saw your post. Following is the solutions

    // returns USER+MachineCombo with Role
    // required headers
    //Query format Below
    //http://localhost:9090/lcapi/usermachine/?uid=EMP002&mid=E0138
    //change in error return routine running backup in downloads ending with 16204.zip
    header(“Access-Control-Allow-Origin: *”);
    header(“Access-Control-Allow-Headers: access”);
    header(“Access-Control-Allow-Methods: GET”);
    header(“Access-Control-Allow-Credentials: true”);
    header(‘Content-Type: application/json’);
    //global variables to share value to existingoperations
    [clnOperMaxTime]=0;
    [pfmOperMaxTime]=0;
    [cSequenceNo]=0;
    [cMacID]="";
    //Routine to get user and machine details
    $data_arr[‘usermachine’] = array();
    $usermachine=array();
    $maclocmaster=array();
    $opermaster=array();

    $data_json[‘usermachine’] = array();
    $err_arr = array();
    $errorfound=0;
    $errstr=‘ERROR’;
    $err_arr = array(
    “ErrorFound” => 0,
    “ErrTable” =>‘None’,
    “ErrorMessage” =>‘AllOk’
    );
    $maclocmaster = array(
    “cSeqno” => 0,
    “cMacID” => ‘NA’,
    “cInterval” => 0,
    “cCleanOperationMaxTime” => 0,
    “cPerformOperationMaxTime”=> 0
    );
    $opermaster = array(
    “oSequenceID” => 0,
    “oMacID” => 'NA ',
    “oItemNumber” => ‘NA’,
    “oBatchNumber” => ‘NA’,
    “oPONumber” => ‘NA’,
    “oCompletedOperation” => 0, // 1Cleaning2 Performing 4 Verifying
    “oComplOperStartTime” => 0,
    “oCompOperEndndTime” => 0,
    “oOperationToContinue” => 0
    );

    //machinemaster with user details and machine details
    if (isset($_GET[‘uid’]))
    {
    $uidp = $_GET[‘uid’]; //$idp = 60;//
    }
    else
    {
    $errorfound=1;
    $usermachine = array(
    “employeeid” => ‘EMPTY’,
    “employeename” => ‘N.A.’,
    “mMacID” => ‘EMPTY’,
    “machinename”=> ‘N.A.’,
    “iscleaning” => 0, // html_entity_decode($description),
    “isperforming” => 0,
    “isverifying” => 0
    // “category_name” => $category_name
    );

    $err_arr = array(
    "ErrorFound" =&gt;1,
     "ErrTable" =&gt;'machinemaster',
    "ErrorMessage" =&gt;"Invalid User"
    );
    
    //array_push ($err_arr['Errors'], 'Invalid User');
    //$errstr .= 'No UID';
    $uidp='';
                 //$uidp   = 'EMP002';
            }
    

    if (isset($_GET[‘mid’]))
    {
    $midp = $_GET[‘mid’]; //$idp = 60;//
    }
    else
    {
    $errorfound=1;
    $usermachine = array(
    “employeeid” => ‘NORECORD1’,
    “employeename” => ‘N.A.’,
    “mMacID” => ‘NORECORD1’,
    “machinename”=> ‘N.A.’,
    “iscleaning” => 0, // html_entity_decode($description),
    “isperforming” => 0,
    “isverifying” => 0
    // “category_name” => $category_name
    );

    $err_arr = array(
    "ErrorFound" =&gt;1,
     "ErrTable" =&gt;'machinemaster',
    "ErrorMessage" =&gt;"Invaid Machine"
    );
    //array_push ($err_arr['Errors'], 'Invalid Machine');
    //$errstr .= ' No MID';
                 $midp   = '';
    //$midp   = 'E0138';
            }
    

    $check_where = “mRowActive = 1 and trim(machinemaster.memployeeID) = '” .$uidp ."’ and trim(machinemaster.mMachineID) = ‘" .$midp ."’" ;

    $check_sql = "SELECT machinemaster.mmSequence ,machinemaster.mMachineID ,machinemaster.mMachineName , machinemaster.mMachineDes ,machinemaster.memployeeID ,usermaster.uemployeename ,machinemaster.isCleaning, machinemaster.isPerforming ,machinemaster.isVerifying , machinemaster.mRowActive FROM machinemaster inner join usermaster on machinemaster.memployeeID = usermaster.uemployeeID WHERE " .$check_where;
    //$check_sql->bindParam(1, $this->idp);
    sc_select(rs, $check_sql);

    if (false == {rs})
    {
    $errorfound=1;
    $usermachine = array(
    “employeeid” => ‘DB Error1’,
    “employeename” => ‘N.A.’,
    “mMacID” => ‘DB Error1’,
    “machinename”=> ‘N.A.’,
    “iscleaning” => 0, // html_entity_decode($description),
    “isperforming” => 0,
    “isverifying” => 0
    // “category_name” => $category_name
    );

    $err_arr = array(
    "ErrorFound" =&gt;1,
     "ErrTable" =&gt;'machinemaster',
    "ErrorMessage" =&gt;"DB Error"
    );
    

    //array_push ($err_arr[‘Errors’], ’ MachineMaster DB Error’);
    }
    elseif ({rs}->EOF)
    {
    // No record found
    $errorfound=1;
    $usermachine = array(
    “employeeid” => ‘Not Record1’,
    “employeename” => ‘N.A.’,
    “mMacID” => ‘Not Record1’,
    “machinename”=> ‘N.A.’,
    “iscleaning” => 0, // html_entity_decode($description),
    “isperforming” => 0,
    “isverifying” => 0
    // “category_name” => $category_name
    );

    $err_arr = array(
    "ErrorFound" =&gt;1,
     "ErrTable" =&gt;'machinemaster',
    "ErrorMessage" =&gt;"No Record"
    );
    

    //array_push ($err_arr[‘Errors’], ‘No record in MachineMaster’);
    }
    else
    {
    $errorfound=0;
    $rs->MoveFirst();
    $mid = $rs->fields[1];
    $mname=$rs->fields[2];
    $uid=$rs->fields[4];
    $uname=$rs->fields[5];
    $iscleaning=(int)$rs->fields[6];
    $isperforming=(int)$rs->fields[7];
    $isverifying=(int)$rs->fields[8];
    //$category_name = $rs->fields[5];

    $usermachine = array(
    “employeeid” => $uid,
    “employeename” => $uname,
    “mMacID” => $mid,
    “machinename”=> $mname,
    “iscleaning” => $iscleaning, // html_entity_decode($description),
    “isperforming” => $isperforming,
    “isverifying” => $isverifying
    // “category_name” => $category_name
    );
    array_push ($data_arr[‘usermachine’], $usermachine);

    }

    // routine to get intervals from Master. Performing Individuals from Pinterval as a seperate service
    // machinelocationmaster

    if(0==$errorfound)
    {
    $check_where = “cRowActive = 1 and trim(cMachineID) = '” .$midp ."’";
    $check_sql = "SELECT cSequenceNo , cMachineID , cInterval , cCleanOperationMaxTime,cPerformOperationMaxTime , cRowActive FROM machinelocationmaster WHERE " .$check_where;

    sc_select(rs, $check_sql);

    if (false == {rs})
    {
    $errorfound=1;
    //echo ( $check_sql );
    $maclocmaster = array(
    “cSeqno” => 0,
    “cMacID” => ‘DB Error2’,
    “cInterval” => 0,
    “cCleanOperationMaxTime” => 0,
    “cPerformOperationMaxTime”=> 0
    );

    $err_arr = array(
    "ErrorFound" =&gt;1,
     "ErrTable" =&gt;'MachineLocationMaster',
    "ErrorMessage" =&gt;"DB  Error"
    );
    

    //array_push ($err_arr[‘Errors’], ’ MacLocMaster DB Access Error’);
    }
    elseif ({rs}->EOF)
    {
    // No record found
    $errorfound=1;
    $maclocmaster = array(
    “cSeqno” => 0,
    “cMacID” => ‘No Record2’,
    “cInterval” => 0,
    “cCleanOperationMaxTime” => 0,
    “cPerformOperationMaxTime”=> 0
    );

    $err_arr = array(
    "ErrorFound" =&gt;1,
     "ErrTable" =&gt;'MachineLocationMaster',
    "ErrorMessage" =&gt;"No Record"
    );
    

    //array_push ($err_arr[‘Errors’], ’ No Record in MacLocMaster No Record’);
    }
    else
    {
    $errorfound=0;
    $rs->MoveFirst();
    $cSeqno =(int) $rs->fields[0];
    $cMacID = $rs->fields[1];
    $cInterval =(int) $rs->fields[2];
    $cCleanOperationMaxTime=(int)$rs->fields[3];
    $cPerformOperationMaxTime=(int)$rs->fields[4];
    $maclocmaster = array(
    “cSeqno” => $cSeqno,
    “cMacID” => $cMacID,
    “cInterval” => $cInterval,
    “cCleanOperationMaxTime” => $cCleanOperationMaxTime,
    “cPerformOperationMaxTime”=> $cPerformOperationMaxTime
    );
    array_push ($data_arr[‘usermachine’], $maclocmaster);
    [clnOperMaxTime]=$cCleanOperationMaxTime;
    [pfmOperMaxTime]=$cPerformOperationMaxTime;
    [cSequenceNo]=$cSeqno;
    [cMacID]=$cMacID;

    }
    } //if errorfound=0 machinelocationmaster

    // Operation master details. to find the last operation done and if it is open
    /*
    SELECT * FROM lcapp.operationmaster where (ocleaningDone =0 or operformingDone =0 or overifyingDone =0) and( oEpochDT = (select Max(oEpochDt) from lcapp.operationmaster) and oabandoned =0 )

    */

    // Operation master details
    if(0==$errorfound)
    {

    $check_sql = “SELECT oSequenceID , oDateTime , oItemNumber , oBatchNumber , oPONumber , oMachineID , oCleaningDone , oCleaningStartTime , oCleaningEndTime , oPerformingDone , oPerformingStartTime , oPerformingEndTime , oVerifyingDone , oVerifyingStartTime , oVerifyingEndTime , oAbandoned , oRemarks,oEpochDt FROM operationmaster WHERE (ocleaningDone =0 or operformingDone =0 or overifyingDone =0) and( oEpochDT = (select Max(oEpochDt) from operationmaster) and oabandoned =0 and oMachineID = '”.$cMacID ."’) ";

    sc_select(rs, $check_sql);

    if (false == {rs})
    {
    $errorfound=1;
    //echo ( $check_sql );
    $opermaster = array(
    “oSequenceID” => 0,
    “oMacID” => ‘DB Error3’,
    “oItemNumber” => ‘NA’,
    “oBatchNumber” => ‘NA’,
    “oPONumber” => ‘NA’,
    “oCompletedOperation” => 0, // 1Cleaning2 Performing 4 Verifying
    “oComplOperStartTime” => 0,
    “oCompOperEndndTime” => 0,
    “oOperationToContinue” => 0
    );

    $err_arr = array(
    "ErrorFound" =&gt;1,
     "ErrTable" =&gt;'operationmaster',
    "ErrorMessage" =&gt;"DB  Error"
    );
    

    //array_push ($err_arr[‘Errors’], ’ OperationMaster DB Access Error’);
    }
    elseif ({rs}->EOF)
    {
    // No record found
    $errorfound=1;
    $opermaster = array(
    “oSequenceID” => 0,
    “oMacID” => ‘No Record3’,
    “oItemNumber” => ‘NA’,
    “oBatchNumber” => ‘NA’,
    “oPONumber” => ‘NA’,
    “oCompletedOperation” => 0, // 1Cleaning2 Performing 4 Verifying
    “oComplOperStartTime” => 0,
    “oCompOperEndndTime” => 0,
    “oOperationToContinue” => 0
    );

    $err_arr = array(
    "ErrorFound" =&gt;1,
     "ErrTable" =&gt;'operationmaster',
    "ErrorMessage" =&gt;"No Record"
    );
    

    //array_push ($err_arr[‘Errors’], ’ No Record OperationMaster’);
    }
    else
    {

    $errorfound=0;
    $rs->MoveFirst();
    $oSequenceID=(int) $rs->fields[0];
    $oMacID = $rs->fields[5];
    $oItemNumber = $rs->fields[2];
    $oBatchNumber = $rs->fields[3];
    $oPONumber = $rs->fields[4];
    $oCleaningDone =(int) $rs->fields[6];
    $oCleaningStartTime =(int) $rs->fields[7];
    $oCleaningEndTime =(int) $rs->fields[8];
    $oPerformingDone =(int) $rs->fields[9];
    $oPerformingStartTime =(int) $rs->fields[10];
    $oPerformingEndTime = (int)$rs->fields[11];
    $oVerifyingDone =(int) $rs->fields[12];
    $oVerifyingStartTime =(int) $rs->fields[13];
    $oVerifyingEndTime =(int) $rs->fields[14];
    $oAbandoned = (int)$rs->fields[15];
    $oEpochDt =(int) $rs->fields[16];

    $datenow = new DateTime();
    $datenow = date(“d-m-Y H:i:s”);
    $datenowEpoch=toEpochDt($datenow);
    $StartFreshSequence=0;
    if($oAbandoned ==0)
    {
    if($oCleaningDone==1 && [clnOperMaxTime]>0)
    {
    if(($datenowEpoch-$oCleaningEndTime) <[clnOperMaxTime])
    {
    //echo "Select Cleaning with sequenceNo
    ";
    $opermaster = array(
    “oSequenceID” => $oSequenceID,
    “oMacID” => $oMacID,
    “oItemNumber” => $oItemNumber,
    “oBatchNumber” =>$oBatchNumber,
    “oPONumber” => $oPONumber,
    “oCompletedOperation” => 1, // 1Cleaning2 Performing 4 Verifying
    “oComplOperStartTime” => $oCleaningStartTime,
    “oCompOperEndndTime” => $oCleaningEndTime,
    “oOperationToContinue” => 2
    );
    array_push ($data_arr[‘usermachine’], $opermaster);
    } //if(($datenowEpoch-$oCleaningEndTime) <[clnOperMaxTime])
    else //if(($datenowEpoch-$oCleaningEndTime) <[clnOperMaxTime])
    {
    //echo "Abandon Cleaning with remark
    ";
    $updatesql = "UPDATE operationmaster SET oAbandoned=1 , oRemarks =‘Idle time limit to perform exceeded’ WHERE oSequenceID= " .$oSequenceID;
    // Start as new Sequence
    $StartFreshSequence=1;

    } //else f(($datenowEpoch-$oCleaningEndTime) <[clnOperMaxTime])

    } //if($oCleaningDone==1 && [clnOperMaxTime]>0)
    // Next performing check here

    if($oPerformingDone==1 && [pfmOperMaxTime]>0)
    {
    if(($datenowEpoch-$oPerformingEndTime) <[pfmOperMaxTime])
    {
    //echo "Select Performing with sequenceNo
    ";
    $opermaster = array(
    “oSequenceID” => $oSequenceID,
    “oMacID” => $oMacID,
    “oItemNumber” => $oItemNumber,
    “oBatchNumber” =>$oBatchNumber,
    “oPONumber” => $oPONumber,
    “oCompletedOperation” =>2, // 1 -Cleaning 2 Performing 4 Verifying
    “oComplOperStartTime” => $oPerformingStartTime,
    “oCompOperEndndTime” => $oPerformingEndTime,
    “oOperationToContinue” => 4
    );
    array_push ($data_arr[‘usermachine’], $opermaster);
    } //if(($datenowEpoch-$oPerformingEndTime) <[pfmOperMaxTime])
    else
    {
    //echo "Abandon Performing with remark
    ";
    $updatesql = "UPDATE operationmaster SET oAbandoned=1 , oRemarks =‘Idle time limit to verify exceeded’ WHERE oSequenceID= " .$oSequenceID;
    // Start as new Sequence
    $StartFreshSequence=1;
    } //else if(($datenowEpoch-$oPerformingEndTime) <[pfmOperMaxTime])

    } //if($oPerformingDone==1 && [pfmOperMaxTime]>0)

    //End Performing Condition check
    } //if($oAbandoned ==0)
    if($StartFreshSequence==1)
    {
    $opermaster = array(
    “oSequenceID”=> 0,
    “oMacID” => $cMacID,
    “oItemNumber” => ‘’,
    “oBatchNumber” =>’’,
    “oPONumber” => ‘’,
    “oCompletedOperation” => 0, // 1 Cleaning 2 Performing 4 Verifying
    “oComplOperStartTime” => 0,
    “oCompOperEndndTime” => 0,
    “oOperationToContinue” => 1
    );
    array_push ($data_arr[‘usermachine’], $opermaster);
    $StartFreshSequence=0;
    }

    } //else if (false == {rs})

    } //if errorfound=0 operationMaster details

    // END of operation master details.

    // PIntervalSection Start

    // PintervalSectionEnd

    // routine Lastly send data or err message
    /**
    if(1==$errorfound)
    {
    http_response_code(404);

    echo json_encode($err_arr);
    //echo json_encode(array(‘Error’ => .$check_sql ));
    }
    **/
    //if(0==$errorfound)
    {
    http_response_code(200);
    // echo json_encode($data_arr);
    //$usermachine=array();
    //$maclocmaster=array();
    //$opermaster=array();
    //$data_json[‘usermachine’] = array();
    $data_json[‘usermachine’]=array_merge($usermachine,$maclocmaster,$opermaster,$err_arr);
    $out[‘usermachine’] = array_values($data_json);
    echo json_encode($out);

    //echo json_encode($data_json);

    //echo json_encode($data_arr2);

    //echo json_encode(array(‘Error’ => .$check_sql ));
    }

    Most unelegant i am sure as this is my first code with PHP and first with scriptcase too. I am still learning.

    I will most thankful if some one can help to find mistakes and help me correct the same in the above code.