Zipbang
asked on
binding column of type bit in update query
In this setup, the name column (type is nvarchar(50)) updates just fine.
I cannot get the two other columns (IsFrequentlyUsed & IsActive , both of type bit) will not update.
I have confirmed that their values are passed in correctly and I have tried to convert them to 1 or 0 as well. In any case, they do not update. Is there some consideration for bit type columns in this setup?
I cannot get the two other columns (IsFrequentlyUsed & IsActive , both of type bit) will not update.
I have confirmed that their values are passed in correctly and I have tried to convert them to 1 or 0 as well. In any case, they do not update. Is there some consideration for bit type columns in this setup?
$sql = "UPDATE Color
SET
Name =?,
IsActive = ?,
IsFrequentlyUsed = ?
WHERE Id=?";
$params=array( &$Name, &$IsActive,&$IsFrequentlyUsed,&$Idin);
$stmt = sqlsrv_prepare( $conn, $sql, $params, array("Scrollable"=>"buffered"));
if(sqlsrv_execute( $stmt )){
//query succeeds
}else{
//query failed
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You may have better results using true/false instead
Or give more input to your parameters like this
$params = Array( Array(&$param1, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_INT, SQLSRV_SQLTYPE_BIT) );Please try that