note 112287 added to function.sqlsrv-query

From: Date: Mon, 27 May 2013 23:32:47 +0000
Subject: note 112287 added to function.sqlsrv-query
Groups: php.notes 
Request: Send a blank email to php-notes+get-194973@lists.php.net to get a copy of this message
If you are getting an error while attempting to execute your query, and the output of sqlsrv_errors(SQLSRV_ERR_ERRORS) is this: SQLSTATE: IMSSP code: -14 message: An invalid parameter was passed to sqlsrv_query. You have failed to pass a valid parameter to sqlsrv_query itself, which could be one of three parameters: Connection: a valid handled for a SQL Server Connection Query: a valid string containing your query, with placeholders for parameters:"(?)" Parameters: An Array containing the values for your query parameters. (optional, but much match the number of placeholders in your Query. I could not find any information about this error, and it turned out to be a missing connection parameter. In my case I found I had typed "$connn" instead of "$conn" in the code: if ($stmt=sqlsrv_query($conn, $sql, $params)) { ... While this seems like a total "noobie" thing to do, the fact of the matter is there is very little information about this SQL Server Error message itself. So, the plain meaning of SQLSTATE "IMSSP", CODE "-14" is that you provided no valid connection object to your sqlsrv_query function. This message may appear baffling, especially if you have several occurrences of sqlsrv_query on a page, and you may have added a new occurrence after you closed your connection. Since I wasted an enormous amount of time tracing the normal channels, I thought referencing this error here would provide some help. In was hung up on "parameter" and was thinking it was a bad parameter object, and overlooked passing an undefined connection object to sqlsrv_query ---- Server IP: 64.71.164.2 Probable Submitter: 172.254.85.70 ---- Manual Page -- http://php.net/manual/en/function.sqlsrv-query.php Edit -- https://master.php.net/note/edit/112287 Del: integrated -- https://master.php.net/note/delete/112287/integrated Del: useless -- https://master.php.net/note/delete/112287/useless Del: bad code -- https://master.php.net/note/delete/112287/bad+code Del: spam -- https://master.php.net/note/delete/112287/spam Del: non-english -- https://master.php.net/note/delete/112287/non-english Del: in docs -- https://master.php.net/note/delete/112287/in+docs Del: other reasons-- https://master.php.net/note/delete/112287 Reject -- https://master.php.net/note/reject/112287 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#194973) next »