title: Inserting json encoded data into mysql
body: <p>This is a follow up question , earlier i had <a href="https://stackoverflow.com/questions/21622946/inserting-record-into-database-using-json">asked</a>
   about inserting json into mysql . I encoded it again and now i want it to be printed back to mysql . I don't know how am i supposed to print the encoded json output as string back into mysql . Folowing is my current code</p>
  
  <pre><code>&lt;?php
  $json = array
     (
     array("pineapple","yellow"),
     array("watermelon","red"),
     array("orange","orange")
     );
  var_dump($json);
  var_dump(json_decode($json, true));
  
  $newelements = json_encode( $json, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE );
  echo $newelements;
  
  $username = "root";
  $password = "";
  $hostname = "localhost"; 
  
  
  $dbhandle = mysql_connect($hostname, $username, $password) 
    or die("Unable to connect to MySQL");
  echo "Connected to MySQL&lt;br&gt;";
  
  
  $selected = mysql_select_db("json",$dbhandle) 
    or die("Could not select json");
  
  
    //  foreach ($enc as $fruit =&gt; $color) {
  
      $db_insert = mysql_query("INSERT INTO fruits (fruit,color) VALUES('$fruit','$color')");
      mysql_query($db_insert);
  
  
      if (!$db_insert)
      {
      die('Could not connect - event insert failed: ' . mysql_error());
      }
    //  }
  ?&gt;
  </code></pre>
  
  <p>Any help would be much appreciated .Thanks in advance :)</p>