title: json string to php to mysql
body: <p>Here's my json String i get:</p>
  
  <pre><code>[data] =&gt; {"id":"0612833398","longitude":"-143.406417","latitude":"32.785834","timestamp":"10-10 07:56"}
  </code></pre>
  
  <p>And i need it to put it like this in my php file, but i only get NULL values.</p>
  
  <pre><code>&lt;?php
  file_put_contents('dump.txt', "POST: \n" . print_r($_POST, true) . "\n\n\n GET: \n" . print_r($_GET, true));
  
  $link = mysql_connect('server', 'bla', 'bla')
  or die('Could not connect: ' . mysql_error());
  
  mysql_select_db('md267052db227433') or die('Could not select database');
  
  // Performing SQL query
  if (isset($_POST['data'])) {
  $data = json_decode($_POST['data']);
  $id = $data['id'];
  $latitude = $data['latitude'];
  $longitude = $data['longitude'];
  $timestamp = $data['timestamp'];
  
  }
  $query = sprintf("INSERT INTO locatie (id, longitude, latitude, timestamp) VALUES ('%s', '%s', '%s', '%s')", mysql_real_escape_string($id), mysql_real_escape_string($longitude),  mysql_real_escape_string($latitude), mysql_real_escape_string($timestamp))  ;
  $result = mysql_query($query) or die('Query failed: ' . mysql_error());
  echo "OK";
  
  
  // Free resultset
  mysql_free_result($result);
  
  // Closing connection
  mysql_close($link);
  ?&gt;
  </code></pre>
  
  <p>I Feel like im really close:
  The dump.txt from line 1 looks like this:</p>
  
  <p>POST: 
  Array
  (
  )</p>
  
  <pre><code> GET: 
  Array
  (
      [data] =&gt; {"id":"0612833398","longitude":"-143.406417","latitude":"32.785834","timestamp":"10-10 07:56"}
  )
  </code></pre>