-3
I’m getting arrays and would like to save them in the database mysql and I’m not getting it, could you help me?
Follow what I’m getting and how I’d like it to stay:
$nomemorador = $_POST['nomemorador'];
$parentesco = $_POST['parentesco'];
$nascimento = $_POST['dataNascimento'];
All three are arrays! I need to enter in the database as follows:
INSERT INTO moradores (nome, parentesco, nascimento) VALUES ($nomemorador, $parentesco, $nascimento)
All I could do was walk through one:
foreach ($nomemorador as $registro):echo $registro."
I keep trying different ways here and I haven’t gotten it yet!
";endforeach;
If they are arrays, you have to go through this array to perform the Inserts one by one (or a multiple Insert). Can you tell us what your last attempt was and what the result was?
– Woss
Actually what I did, was just go through the array, I couldn’t put them together to do the rest! foreach ($addresser as $record): echo $record." <br>"; endforeach;
– Moises Pequeno
Put it there in the question, please.
– Woss
@Moisespequeno you can do
INSERT
with strings? These values received through$_POST
are all arrays?– Wees Smith
Yeah. Yeah, they’re all arrays!
– Moises Pequeno