2
I am trying to insert data into the database using mysqli prepare more are not inserting the data, and shows no error whatsoever
Questions:::
- What am I doing wrong in this code below?
- That’s the best way to do it?
Could they set an example?
$conecta = new mysqli($hostname, $username, $password, $dbdatabase); if($conecta->connect_error){ echo "Conexao:<span class=\"ls-tag-danger\">Erro!</span>"; }else{ echo "Conexao:<span class=\"ls-tag-success\">OK!</span>"; } $sql = $conecta->prepare("INSERT INTO cotacao (chave,id_transfer,id_empresa,nome) VALUES (?,?,?,?)"); $sql->bind_param('s', $chave,$id_transfer,$idc,$nome); // $sql->execute(); $sql->close(); $conecta->close();
Thank you
OK it worked, I also checked if variable $name is empty the Insert does not work. knows the reason?
– Fabio Henrique
@Fabiohenrique It may be because in the bank she is marked as Not null.
– Velasco
That even worked thanks
– Fabio Henrique