开发者

mssql_query doesn't return anything

I am having problems with setting up a system.

We have a SQL Server 2005 ru开发者_C百科nning and I want to connect it from another windows machine running php 5.2 and apache.

I can connect to SQL using mssql_connect but I can not retrieve any results from a simple query (SELECT * FROM USERS) mssql_query doesnt return anything nor dies or shows an error.

Same code with same php is working on another machine (client of SQL Server machine) and in the PC running SQL Server.

What could be going on?


It may be timing out due to longer time to execute the query? You could try a simpler query like SELECT 1

If it is a timeout issue, you may have to look into why does it happen to this computer...or you may be able to fix it by having this line in code before the query executes: ini_set('mssql.timeout', seconds) where seconds is a number.


I've never worked with MsSQL before but try setting error_reporting(E_ALL) at the top of your file and after calling mssql_query() do a var_dump(mssql_get_last_message()).


If the query just hangs, then probably the table is locked.

Could you please run a query that does not involve any tables (like mere SELECT 1) and see if it works?


I would start with configuration. If it's working fine from another machine and this is the only one with an issue then
1. Compare drivers between the working / non-working machines.
2. Compare php installations.

You get the picture.

Also, I'm not sure what you mean by "(client of SQL Server machine)"...


Thanks everybody, I solved it. There was a upper/lowercase mistake on my php code, and I was not treating any rows of the resultset.

It took me hours to notice this stupid thing!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜