Page 1 of 1

PDO - bindParam and variables type

Posted: Fri Jan 30, 2009 12:25 pm
by Rik
Hi all!
Little question (for those who already know the answer :) )

Code: Select all

$stm->bindParam(1,$id,PDO::PARAM_INT);
$db->execPrepare();
PDO::PARAM_INT really force $id to be seen/written as integer the same as

Code: Select all

$db->execPrepare(array( settype($id,'int') ));
or is only usefull with store procedures?

Re: PDO - bindParam and variables type

Posted: Fri Jan 30, 2009 1:03 pm
by Rik
Autoreply: No, at least not with my test on DB. In fact

Code: Select all

$stm->bindParam(5,$fields['description'],PDO::PARAM_INT);
save regularly the alfanumeric field ignoring PARAM_INT, while obviously, a settype change any description to a value and quite surely a zero value.