Jump to content

Warning: sqlsrv_fetch_array() expects parameter 1 to be resource, boolean given in


Go to solution Solved by vbcoach,

Recommended Posts

All of a sudden I am getting this error.  Just started - no change in code that I am aware of.  Googling this error is not helping much.  Can anyone assist?

 

Warning: sqlsrv_fetch_array() expects parameter 1 to be resource, boolean given in...

it means your query failed due to an error and returned a false value or you could be using a wrong variable name or there's a problem in your code and this error was always occurring but was hidden and what changed is that the php error_reporting level got changed.

 

does your code that is running the query contain any error checking logic in it so that you would know if the query is producing an error, and if so, what is the output from sqlsrv_errors()?

Warning: sqlsrv_fetch_array() expects parameter 1 to be resource, boolean given in\\WDP\DFS\30\0\8\8\3049380880\user\sites\3395336.site\www\database.php on line 46

 

Line 46 from database.php is:

 //return mssql_fetch_assoc($resource);
 return sqlsrv_fetch_array($resource, SQLSRV_FETCH_ASSOC);

 

This script has been working for years.  Just stopped last night.

your reply above doesn't provide any additional information and contains nothing i asked about.

 

without even seeing your code that runs the query, i can tell it does not have any error checking logic in it, and the php error you are getting is a follow-on error because you allowed your code to try to fetch data from a query that failed with an error of some kind.

 

it doesn't matter how long your code may have previously worked. it requires finding out why it is failing now in order to find the cause to fix it. until you add some logic to your code that tells you the output from sqlsrv_errors() when the query fails, you will never discover what is causing the problem.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.