1
Guys I’m trying to separate the array but it all comes together in this way fernandohenriquelopes I wanted to separate them so I can make multiple Insert in the bank the code is like this
// aqui recebe em array
$dad = filter_input(INPUT_POST, 'tituloFoto', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
foreach ($dad as $id => $titulos) {
$re = array( ++$id => $titulos);
print_r($re); // desta forma sai normal
//Array ( [1] => fernadno ) Array ( [2] => rafael ) Array ( [3] => yeyeye )
// se eu tirar o print_r fica assim
Notice: Array to string conversion in C:\xampp\htdocs\arte-beleza\galeria-gravar.php on line 21
Array (3x)
}
When I write to the database it only shows array 3 times someone helps me?
You want to make multiple Inserts of each item from
Array
returned to print_r ?– Alisson Acioli
this friend but I managed to solve. Where can I put the result of how I did?
– heitor_deep
You can put it right here as a response and mark it as solved.
– Papa Charlie
you can use serialize in the array to save to the database and unserialize to recover from the database, so the array is saved in string form and retrieved in array form, without losing the keys you defined.
– Bruno Folle
@Brunofolle liked this idea I will test. Even if I have already solved it is good that learning new things
– heitor_deep