Jump to content

Archived

This topic is now archived and is closed to further replies.

vbcoach

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

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...

Share this post


Link to post
Share on other sites

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()?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

There are sqlsvr_errors() written in the code.  However this is still what I am getting.  Any suggestions?

Share this post


Link to post
Share on other sites

DISREGARD!  Found the answer.  redundant statement in the sql query itself.  thanks to all who posted!

Share this post


Link to post
Share on other sites

×
×
  • 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.