I've put some crud classes in PDO and almost all of them have 4 or 5 fields in the DB, they worked correctly.
Now I am trying to create a crud of 6 fields, but it does not create the record in the DB at all, I rewrote the class again thinking it to be a typo, but even doing everything again continues the same way, without registering the data in the DB. The isset Post is picking up the form data correctly, naming the variables are correct
With 4 columns in DB:
public function create($testA,$testB,$testC,$testD)
{
try
{
$stmt = $this->db->prepare("INSERT INTO ColunaUm(testA,testB,testC,testD) VALUES(:testA, :testB, :testC, :testD)");
$stmt->bindparam(":testA",$testA);
$stmt->bindparam(":testB",$testB);
$stmt->bindparam(":testC",$testC);
$stmt->bindparam(":testD",$testD);
$stmt->execute();
return true;
}
catch(PDOException $e)
{
echo $e->getMessage();
return false;
}
}
With 6 Columns:
public function create($testA,$testB,$testC,$testD,$testE,$testF)
{
try
{
$stmt = $this->db->prepare("INSERT INTO ColunaDois(testA,testB,testC,testD,testE,testF) VALUES(:testA, :testB, :testC, :testD, :testE, :testF)");
$stmt->bindparam(":testA",$testA);
$stmt->bindparam(":testB",$testB);
$stmt->bindparam(":testC",$testC);
$stmt->bindparam(":testD",$testD);
$stmt->bindparam(":testE",$testE);
$stmt->bindparam(":testF",$testF);
$stmt->execute();
return true;
}
catch(PDOException $e)
{
echo $e->getMessage();
return false;
}
}
In PDO is there a different treatment when saving depending on the number of fields?