title: How to add data from different array variables to a sql table in php
body: <p>I have been trying to insert data into a table(mySql) from 3 arrays using php. Each time i run the script i get a long list on unsuccesful entries. I am new to php and sql, what am i doing wrong here ? how do i get the query string to recognize these variables ? i have tried searching around but could not make sense of much.   </p>
  
  <pre><code>$id=array();
  $comp=array();
  $mobname=array();
  
  for($x=0;$x&lt;$arrlength;$x++)
  {
  
    if(mysqli_query($con,"INSERT INTO Umobile VALUES ($id[$x],$comp[$x],$mobname[$x])"))
       echo "added",$id[$x]," ",$comp[$x]," ",$mobname[$x];
    else
       echo " unsuccessful ";
  
      //echo $id[$x]," ",$comp[$x]," ",$mobname[$x];
     echo "&lt;br/&gt;";  
   }
  </code></pre>