I am trying to get json values but I get :
Warning: Illegal string offset 'data_id' in /home/myFiles/thepage.com/djs.php on line 17
Warning: Illegal string offset 'data_key' in /home/myFiles/thepage.com/djs.php on line 17
include("func/cnfng.php");
include_once 'func/func.php'; // Functions
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$Ups = new THE_UPDATES($db);
$TheData = $Ups->Data();
$sql = mysqli_query($db,"SELECT * FROM myData") or die(mysqli_error($db));
$arr= [];
$row = mysqli_fetch_array($sql, MYSQLI_ASSOC);
foreach($row as $data) {
$arr[] = [
$data['data_id'] => $TheData[$data['data_key']]['English']
// ^
// |__ This is on line 17
];
}
echo json_encode($arr);
Can you help me with the solution, please.