title: insert array value in database in php
body: <p>I am working on insert array value in database in php using oops.I call a class on my form page .</p>
  
  <pre><code>&lt;?php
  $pid=$_POST['pid'];
  $ecode=$_POST['ecode'];  {these are my form value)
  $rcode=$_POST['rcode'];
  $dk=$_POST['dk'];
  $qd=$_POST['qd'];
  $tp=$_POST['tp'];
  $vd=$_POST['vd'];
  $valArr=array($pid,$ecode,$rcode,$dk,$qd,$tp,$vd);
  
  if(isset($_POST['form_submit'])){
      $requester=new performance();
      $requester-&gt;addRow($valArr);
  }
  ?&gt;
  </code></pre>
  
  <p>and class performance code is</p>
  
  <pre><code>class performance extends DataAccess
  {
      {
          $this-&gt;obj= new DataAccess;
  
      }
      function addRow($valArr)
      {
          foreach ($valArr as $key=&gt;$value )
  
              $sql=   INSERT INTO employee_performance (id, empcode,review_emp_id,
                      subject_matter,quality_of_delivery, team_player,value_added)
                      VALUES $value
      }
      $sql=mysql_query($sql);
  }
  }
  </code></pre>
  
  <p>its can't insert all record in database.how I do this?  </p>
  
  <p>I want to know how can I insert this data in mysql database using foreach.</p>