I want to upload each one of the: Titles, Lists and descriptions Knowing that: $ title is executed 40 times with different titles $ list is executed 40 times with different list $ description is executed 40 times with different description I can not get the (3) elements uploaded to the database at the same time when going through the foreach. I must say that I deleted code here because I have more code and more data, I wanted to make it as simple as possible. There is some way to do it, if something is wrong I will edit my question, thank you very much
CONNECTION TO THE BD
$usuario = "root";
$password = "";
$servidor = "localhost";
$basededatos = "lista_o";
$conexion = mysqli_connect( $servidor, $usuario, $password ) or die ("No se ha podido conectar al servidor de Base de datos");
$db = mysqli_select_db( $conexion, $basededatos ) or die ( "Upps! Pues va a ser que no se ha podido conectar a la base de datos" );
The data of these foreachs are from another website
foreach($match[1] as $urls)
{
foreach($buscamea[1] as $tengoas)
{
foreach($titulos[1] as $titulo)
{
//AQUI MUESTRAN TODOS LOS TITULOS
echo "<p>".$titulo."</p>";
}
foreach($listas[1] as $lista)
{
echo $lista;
}
foreach($descripciones[1] as $descripcion)
{
echo "<p>".$descripcion."</p>";
}
}
}
$insertar = mysqli_query($conexion, "INSERT INTO backup (nombre, desc_corta, desc_larga) VALUES
('$titulo', '$lista', '$descripcion')");
if (!$insertar) {
die("Fallo al guardar los datos:" . mysqli_error($conexion));
}
else {
echo "<center><h1>subido con exito</h1></center>";
}
mysqli_close( $conexion );
ASD