title: INSERT ARRAY TO MYSQL USING PHP WITH JSON
body: <p>Please help me to insert this to my database.</p>
  
  <pre><code>//Start session
  session_start();
  
  //database connection
  require_once 'connection.php';
  
  $data = json_decode(json_encode($_POST), true);
  
  foreach($data as $key =&gt; $value) {
  
      $prefix = strtoupper($data[$key]['prefix']);
      $fullname= strtoupper($data[$key]['fullname']);
      $position= strtoupper($data[$key]['position']);
  
      $result= connect("INSERT INTO `register_info` (prefix, fullname, position) VALUES ('$prefix','$fullname','$position')");
  
  }
  
   if($result){
      echo json_encode(true);
   }else{
       echo json_encode(false);
   }
  </code></pre>
  
  <p>I Think there's an error in $result.. but I don't know what is that?
  Please help me guys. </p>