i set up a test table zTestTable, with a TestID autoincrement primary key int, a Test (nvarchar(200)) and a TestNumber(int). when i execute the following code, it inserts a row with the value 1 for Test and TestNumber. the same thing happens if i try to use ? parameters instead of named parameters.
$oConnection = new PDO($sDSN);$sSQL = 'INSERT INTO zTest_TBL (Test, TestNumber) VALUES (:Test, :TestNumber) ';
$oStatement = $oConnection->prepare($sSQL);
$s='test insert string passing an array to execute';
$i=1;
$oStatement->execute(array(':Test'=>$s,':TestNumber'=>$i));
print_r($oStatement->errorInfo());
the second bit of code is an attempt to bind parameters and run the same
insert. this one inserts a row with NULLs for Test and TestNumber.
$oConnection = new PDO($sDSN);$sSQL = 'INSERT INTO zTest_TBL (Test, TestNumber) VALUES (:Test, :TestNumber) ';
print $sSQL;
$oStatement = $oConnection->prepare($sSQL);
$s2='test insert string binding a parameter';
$oStatement->bindParam(':Test', $s2, PDO::PARAM_STR);
$oStatement->bindParam('TestNumber', $i, PDO::PARAM_INT);
$oStatement->execute();
thanks in advance,
--travis
smime.p7s
Description: S/MIME Cryptographic Signature
