-5

enter image description here

This is php script code

/*14*/ while($row=mysqli_fetch_array($result))
/*15*/ {
/*16*/     array_push($response,array("id"->$row["id"],"title"->$row["title"]));
/*17*/ }

and i have an error showing

Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ')' in get_info.php on line 16

I can't find what syntax error is. All my braces are closed, I don't know what is the error in this '->'

M. Eriksson
  • 13,450
  • 4
  • 29
  • 40
  • _Side note:_ PHPMyAdmin is a web based management software for MySQL databases. Unless you're modifying that software's code directly, your app has noting to do with it. – M. Eriksson Jan 15 '18 at 06:01

1 Answers1

2

Use => instead of -> to assign a value to array index. also you should replace jason_encode($response) with json_encode($response).

Example

array_push($response, array("id"=>$row['id'], 'title'=> $row['name']));
shubham715
  • 3,324
  • 1
  • 17
  • 27