You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a NULL value exists in the parameters when calling sqlsrv_query, it
replaces the PHP NULL value with a reference. All variables end up containing
the same value.
E.g.
$params = array('abd' 'def', NULL);
sqlsrv_query($conn, $tsql, $params);
NULL is now a reference, so:
$newVar = '123'; // ALL null values now become '123'
$otherVar = '456' // $newVar, $otherVar and $params[2] are all '456', along
with any other variables that happen to be NULL.
I posted this in the MSDN forum: [ http://social.msdn.microsoft.com/Forums/en-
US/sqldriverforphp/thread/b4f0fdc1-62ce-4449-95f1-a9536311223a
](http://social.msdn.microsoft.com/Forums/en-
US/sqldriverforphp/thread/b4f0fdc1-62ce-4449-95f1-a9536311223a)
Sorry, I'm not great at describing things.
Work Item Details
Original CodePlex Issue:Issue 12205 Status: Closed Reason Closed: Unassigned Assigned to: Unassigned Reported on: Dec 24, 2008 at 9:28 AM Reported by: robertjohnson Updated on: May 29, 2009 at 8:45 PM Updated by: icosahedron Closed on: May 29, 2009 at 8:45 PM
The text was updated successfully, but these errors were encountered:
On 2009-05-30 03:44:49 UTC, icosahedron commented:
The workaround is to add a & to each parameter. This is now documented in CU2. When a variable without an & is passed as a parameter, a warning is issued as well.
When a NULL value exists in the parameters when calling sqlsrv_query, it
replaces the PHP NULL value with a reference. All variables end up containing
the same value.
E.g.
$params = array('abd' 'def', NULL);
sqlsrv_query($conn, $tsql, $params);
NULL is now a reference, so:
$newVar = '123'; // ALL null values now become '123'
$otherVar = '456' // $newVar, $otherVar and $params[2] are all '456', along
with any other variables that happen to be NULL.
I posted this in the MSDN forum: [ http://social.msdn.microsoft.com/Forums/en-
US/sqldriverforphp/thread/b4f0fdc1-62ce-4449-95f1-a9536311223a
](http://social.msdn.microsoft.com/Forums/en-
US/sqldriverforphp/thread/b4f0fdc1-62ce-4449-95f1-a9536311223a)
Sorry, I'm not great at describing things.
Work Item Details
Original CodePlex Issue: Issue 12205
Status: Closed
Reason Closed: Unassigned
Assigned to: Unassigned
Reported on: Dec 24, 2008 at 9:28 AM
Reported by: robertjohnson
Updated on: May 29, 2009 at 8:45 PM
Updated by: icosahedron
Closed on: May 29, 2009 at 8:45 PM
The text was updated successfully, but these errors were encountered: