Link to home
Start Free TrialLog in
Avatar of Zipbang
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?

$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
	
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No errors?
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