[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

sqlsrv generic errors

Posted on 2012-04-13
4
Medium Priority
?
513 Views
Last Modified: 2012-04-18
i have recently started getting generic errors with the sqlsrv php mssql plugin.  i have been using it for a while now and have had no problems.  recently I moved my entire site/ databases to a new server, moss 2010, mssql 2008.  with the sqlsrv plugin you can access sql2008 from php.  i have always used the code

     $retval = runQuery($conn,$tsql);
		if(sizeof(sqlsrv_errors(SQLSRV_ERR_ERRORS),0)>0){
			$myErrors = json_encode(array("status"=>"Failed","step"=>"Update tools","errors"=>json_encode(sqlsrv_errors())));
			sqlsrv_rollback($conn);
			die($myErrors);
		}

Open in new window

to run the sql statment and check to see if there were any errors.  this used to return the actualy SQL error returned from MSSql 2008.  since we have moved to the new server i have been getting a generic error that makes no sense.

the error we have been getting is

SQLSTATE:IMSSP,
code:-14,
message:An invalid parameter was passed to sqlsrv_free_stmt.

I get this error from sqlsrv no matter the SQL error.  i am trying to see if the person adding the record will hit a Key contraint but i cannot tell what the error was with this.  i get this error wether i use sqlsrv_free_stmt or not. i get it even if i remove all instances of sqlsrv_free_stmt from my php code.

i have done alot of searching on this and can find many examples of "An invalid parameter was passed to " but the are always to other functions.  never to sqlsrv_free_stmt
0
Comment
Question by:talonsblade
  • 3
4 Comments
 
LVL 14

Expert Comment

by:Scott Madeira
ID: 37844206
What version of PHP, SQL server driver, etc.?
0
 

Author Comment

by:talonsblade
ID: 37844435
PHP 5.3.5

sqlsrv 2.0  just noticed that 3.0.1 was released on april9, need to check that out
0
 

Accepted Solution

by:
talonsblade earned 0 total points
ID: 37844622
figured out my problem, i was using a function to run my sqlsrv statments that didnt return any data, so i can quickly run update/insert statments.  this function was on another page and included a sqlsrv_free_stmt.  when i quit using my function and just called sqlsrv_query i got the correct error.  dont know why i have never had this error before.
0
 

Author Closing Comment

by:talonsblade
ID: 37859744
figured out the error myself and it was a stupid one
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses
Course of the Month19 days, 11 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question