title: Cannot use a scalar value as an array while using PDO
body: <p>I am trying to input data from a JSON API into a MySQL DB but I have an error.</p>
  <p>This is the error.</p>
  <blockquote>
  <p>Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\simplehtmldom\example\scraping\example_scraping_imdb.php on line 8</p>
  <p>Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\simplehtmldom\example\scraping\example_scraping_imdb.php on line 9</p>
  <p>Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\simplehtmldom\example\scraping\example_scraping_imdb.php on line 10</p>
  <p>Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\simplehtmldom\example\scraping\example_scraping_imdb.php on line 11</p>
  <p>Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\simplehtmldom\example\scraping\example_scraping_imdb.php on line 12</p>
  <p>Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\simplehtmldom\example\scraping\example_scraping_imdb.php on line 13</p>
  <p>Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\simplehtmldom\example\scraping\example_scraping_imdb.php on line 14</p>
  <p>Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\simplehtmldom\example\scraping\example_scraping_imdb.php on line 15</p>
  </blockquote>
  <p>Al those lines are the bind param statements in the PHP code.</p>
  <p>Here is the code that I use (The JSON objects are nested):</p>
  <pre><code>&lt;?php
  
  $db = new PDO('mysql:host=localhost;dbname=wtd','root','');
  $jsondata = file_get_contents('https://hugo.events/genre/pop/next/200/100');
  $data = json_decode($jsondata, true);
  $stmt = $db-&gt;prepare(&quot;insert into events values(?,?,?,?,?,?,?,?)&quot;);
  foreach ($data as $row) {
      $stmt-&gt;bindParam(1, $row['hits']['hits']['_id']);
      $stmt-&gt;bindParam(2, $row['hits']['hits']['fields']['name']);
      $stmt-&gt;bindParam(3, $row['hits']['hits']['fields']['start']);
      $stmt-&gt;bindParam(4, $row['hits']['hits']['fields']['venue.location']);
      $stmt-&gt;bindParam(5, $row['hits']['hits']['fields']['description']);
      $stmt-&gt;bindParam(6, $row['hits']['hits']['fields']['header']);
      $stmt-&gt;bindParam(7, $row['hits']['hits']['fields']['logo']);
      $stmt-&gt;bindParam(8, $row['hits']['hits']['fields']['genres']);
      $stmt-&gt;execute();
  }
  </code></pre>
  <p>EDIT: Sample of JSON data:</p>
  <p><a href="https://ghostbin.com/paste/437q7" rel="nofollow noreferrer">https://ghostbin.com/paste/437q7</a></p>
  <p>Hope someone has a sollution. Thanks in advance.</p>