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.
$id=array();
$comp=array();
$mobname=array();
for($x=0;$x<$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 "<br/>";
}