I am retrieving data from the database using a modal in Codeigniter, and when I pass the data to an array using foreach loop, It is giving the error.
Parse error: syntax error, unexpected ':', expecting ')' in D:\xampp\htdocs\base_codeigniter\application\controllers\User.php on line 32
I want to show the json data in a table in the View page.
What is wrong on the line 32
foreach ($get_data as $data) {
$show_table = array(
'name':$data['name'], // Line 32
'email':$data['email'], // Line 33
'phone':$data['phone']
);
echo json_encode($show_table);
}