1

I have to decode json data and insert it to database.

My code:

include 'db.php';
$jsonString = file_get_contents('../question.json');
$data = json_decode($jsonString, true);
$x=1;
foreach ($data as $key1 => $val1) {

And e error : Invalid argument supplied for foreach() in /includes/php/transfer.php on line 6

foreach is my 6th line of code.

I did not get it.. where is a issue?

Piotr Mirosz
  • 846
  • 9
  • 20

0 Answers0