Hello Everyone,
I have a PHP code that reads data from db table. Then it converts it into JSON and show it. However if data table field has - or so then it gives json error.
For e.g.
if($num > 0){
while($res = mysqli_fetch_array($query)){
$NDate = $res['NDate'];
$Summary = substr($res['Summary'],0,256);
/* CREATE ARRAY FOR SHORT TERM NEWSLETTER */
$newsletters[]=array('newsletter'=>array("RecID"=>$SNo,"Summary"=>$Summary));
}
/* JSON OUTPUT*/
$json = array("AuthOK" => 'True',"newsletters"=>$newsletters);
header('Content-type: application/json');
echo json_encode($json);
How to solve the issue ?
Regards,
GR