Well, I need to pass two in the php query, but I can not pass them without being as follows:
$coluna = implode( ',' , $colunas);
$date = implode( " ',' " , $dates);
$teste2 = "'$date'";
//O teste2 está gerando algo como: 'exemplo', 'exemplo'
$sql = "INSERT INTO $table ($coluna)
VALUES ($teste2)";
if ($conn->query($sql) === TRUE) {
echo "<br>Dados enviados com sucesso!";
}
else {
echo '<br>Não foi possível enviar os dados!';
}
The way it works out, but I thought it was a lot of gambiarra to do that, I think there is some better way to do it!
-
$ columns and $ dates are the arrays that are arriving, their size is undefined, since I will be passing those data in several places.
-
I put "','" as implode