How to insert a variable into an array?

3

I want to insert data into my database I'm using mysqli, I need to know how I would indicate an array inside a variable, here and my code I want to know if this is the correct way to do it

require 'config.php'
require 'connection.php'

$nomearquivo ="teste.html";
$nome =$_POST["nome"];
$sexo =$_POST["sexo"];
$dia  =$_POST["dia"];
$mes  =$_POST["mes"];
$ano  =$_POST["ano"];
$abre =@fopen("dadosss.html","a+");
$ess  ="nome: " .$nome. " sexo: " .$sexo." ".$dia."/".$mes."/".$ano;
$escreve =fwrite($abre, $ess );

$inserir = array(
    'nome' => $nome, 
    'sexo' => $sexo,
    'dia'  => $dia,
    'mes'  => $mes,
    'ano'  => $ano,

);

$grava = DBCreate('cadastro', $inserir);

if($grava)
    echo 'OK';
    
asked by anonymous 19.12.2016 / 20:37

1 answer

0

You can use array_push to solve the problem.

    
19.12.2016 / 20:38