I've never made a form, so please forgive me if you're absurdly wrong.
Here is the bank with the table:
CREATE DATABASE db_formacao;
USE db_formacao;
CREATE TABLE 'db_formacao'.'formacoes' (
'ID' INT( 5 ) NOT NULL AUTO_INCREMENT ,
'NOME' VARCHAR( 255 ) NOT NULL ,
'OBJETIVO' TEXT NOT NULL ,
'CARGA' INT( 5 ) NOT NULL ,
'CONTEUDO' TEXT NOT NULL ,
PRIMARY KEY ( 'ID' )
) ENGINE = MYISAM ;
Already here, on the page itself that the form is being built I try to make the connection:
<?php
$conn = new mysqli ("localhost", "root", "", "db_formacoes");
$nome = $_POST['nome'];
$objetivo = $_POST['objetivo'];
$conteudo = $_POST['conteudo'];
$carga = $_POST['carga'];
$squery = "INSERT INTO formacoes (nome, objetivo, conteudo, carga) VALUES('$nome','$objetivo','$conteudo', '$carga' )";
$resultado = mysqli_query($conn,$squery);
if(!mysqli_query($conn, $squery)){
echo 'Opa! Não conseguimos nos conectar ao banco de dados. '. mysqli_error($conn);
}else{
echo 'Operação realizada com sucesso';
}
mysqli_close($conn);
?>
When I click on the save form button nothing happens to indicate that the information has been saved and I'm checking it by doing a select in phpMyAdmin. Here is the result: