I’m creating an app with PHP and SQL Server, I prefer to work with logs, and have just some general information to users in case of error, like a error number defined by me in case of possible known error, and date. but this gives me allots of problems to debug, i have found the PHP log (php-erros.log) very useful and all the errors i get i can see them pretty easy and fast without messing with the code to debug. But i still have the problem with SQL Server, I’m using Microsoft SQL Server (10.50.1600.1), I have found some log files (C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\Log) but these are only have main errors and i can’t see errors from PHP queries, is there any way to activate or to check on those errors easily?
I’m creating an app with PHP and SQL Server, I prefer to work with
Share
Your "sqlsrv_fetch_array() expects parameter 1 to be resource, boolean given" error is not a SQL Server one but PHP.
Can we see your code?
You are trying to fetch data from a failing request. Here is a proper way to work and see what’s happend:
This piece of code:
is what you need: testing the request result before trying to fetch it, and dumping the error.
If you want to send the SQL error to the PHP log you can use the function error_log.