PHP + PDO: Bind null if param is empty

spikiller

New Member
I'm trying this (and all PoST var are treated before user send it, no SQL Injection worries):\[code\]$stmt = $con->prepare($sql);$stmt->bindParam(":1", $this->getPes_cdpessoa());$stmt->bindParam(":2", $this->getPdf_nupessoa_def());\[/code\]When any of those vars are NULL, PDO cries and don't let execute my statement, and on my Table, i DO allow these fields beign nullables.Is there any way to check if the values are empty, pdo just bind NULL to then (and i mean, a smart way instead if(empty($_POST['blablabla')...) for every single param?
 
Back
Top