I have 15 rows of the same data to be inserted repeatedly, is there a way of handling it rather than repeating 15 individual queries?
My current code for 1 row looks like this
$FirstName1=mysqli_real_escape_string($con,$_POST['FirstName1']);
$Surname1=mysqli_real_escape_string($con,$_POST['Surname1']);
$Position1=mysqli_real_escape_string($con,$_POST['Position1']);
$Value1=mysqli_real_escape_string($con,$_POST['Value1']);
mysqli_query($link,"INSERT INTO Players (FirstName, Surname, Position, Value) VALUES ('$FirstName1', '$Surname1', '$Position1', '$Value1')") or die(mysqli_error($link));
Is there a way of running a foreach
to first check the data exists, then loop through and run the insert? The numbers for each field, so "FirstName1" for example will run from 1-15.