title: how to create insert query with multidimensional array in php
body: <p>This class is working perfectly on single array but when i add multidimensional array dont working.i create the class which automatically get column name and values.here is demo code
  array coming like this.</p>
  
  <pre><code>class myform{
      public $key;
      public $value;
      public $query;
      public $con;
      public function __construct(){
      $this-&gt;con = new mysqli('localhost','root','','form')or die('you are losing your mind');}   
     public function form_values($tablename,$values){
      $columns = implode(", ",array_keys($value));
      $escaped_values = array_map('esc_sql', array_values($value));
      $values  = implode("',' ", $escaped_values);
      foreach($valuee as $key =&gt; $valued){       
      $this-&gt;query = "INSERT INTO {$tablename} ($columns)VALUES('$valued[$key]')"; 
         } return $this-&gt;query;
     }
  }
  </code></pre>
  
  <p>Here is usage of this code</p>
  
  <pre><code>if(isset($_POST['submitt'])){
      $new = new myform;
      $values = $_POST;
      $query_form = $new-&gt;form_values('myguests',$values);
  }
  </code></pre>
  
  <p>Array
  (</p>
  
  <pre><code>[objective] =&gt; hj
  [full_name] =&gt; sdad
  [email] =&gt; dsafds
  [phone] =&gt; dasfds
  [nationality] =&gt; adf
  [date_of_birth] =&gt; adsf
  [country] =&gt; dsfasd
  [website] =&gt; asdfds
  [address] =&gt; sadfdsaf
  [my_image_upload_nonce] =&gt; 3b17791a4e
  [_wp_http_referer] =&gt; /cv_builder/
  [job_title] =&gt; Array
      (
          [0] =&gt; asdfds
          [1] =&gt; adsfdsaf
      )
  
  [company_name] =&gt; Array
      (
          [0] =&gt; dasfdaf
          [1] =&gt; asfdsafsd
      )
  
  [comp_other_info] =&gt; Array
      (
          [0] =&gt; adsfdsfdsafdsafasdf
          [1] =&gt; adfadfasfdfadsfsdafsadf
      )
  
  [qualification] =&gt; Array
      (
          [0] =&gt; adsfddsfasdfdaf
      )
  
  [refrence] =&gt; References available upon request.
  [submitt] =&gt; submit
  </code></pre>
  
  <p>)
  i am new to oop concept please suggested me to imporve.Thanks to all</p>