Hey guys, my problem is the following I'm using the PDO object of php to insert records in the database, the problem is when I try to insert only one field in a table example:
$query = 'INSERT INTO alunos (nome) VALUES(:nome)';
$stmt= $conexao->prepare($query);
$stmt->bindValue(':nome',$_POST['nome']);
$stmt->execute();
Well if I try to insert only one field, it will not work if I specify all of it works example:
$query = 'INSERT INTO alunos (numero,nome,username,senha) VALUES(:numero,:nome,:username,:senha)';
$stmt= $conexao->prepare($query);
$stmt->bindValue(':numero',$_POST['numero']);
$stmt->bindValue(':nome',$_POST['nome']);
$stmt->bindValue(':username',$_POST['username']);
$stmt->bindValue(':senha',$_POST['senha']);
$stmt->execute();
Am I doing something wrong in the first example?