I am trying to do this (and all PoST variables are processed before the user submits them, no problem with SQL Injection):
$stmt = $con->prepare($sql);
$stmt->bindParam(":1", $this->getPes_cdpessoa());
$stmt->bindParam(":2", $this->getPdf_nupessoa_def());
When any of these vars is NULL, PDO cries and does not allow my statement to be executed, and in my table I allow these fields to be assigned nullables.
Is there a way to check if the values ββare empty, pdo just binds NULL to that (and I mean, a smart way instead if (empty ($ _ POST ['blablabla') ...) for each individual parameter?
source
share