Hello, I have a code where I get the data coming from a webservice and I save it in variables.
I would like to Inserir/Salvar
this data in my database MySQL . However I get this data through a foreach(){...}
// Pegar os leads
$leads = $client->leads->getLeads([]);
// Pegando os leads
foreach($leads->contacts as $contacts)
{
// Salvando dados nas variáveis
$nome = $contacts->name;
$id = $contacts->id;
$tags = $contacts->tags;
// Percorrendo os dados
foreach($tags->tags as $objeto)
{
$tag = $objeto->name;
}
}
according to the code above. How could I insert this data in a way that would look like this in the table [example] table:
[ID] [NOME] [TAGS]
[01] [JOSÉ] [tag1,tag2,tag3..]
Well, if I create a query like this:
$query = mysqli_query($conexao,"INSERT INTO leads(nome,tags) VALUES ('$nome','$tag')";
Each foreach(){..}
would have a different tag and would overwrite the tag value. >