[PHP-DB] SQL Server Query Failed

2004-03-17 Thread david
Hello there!

I have just about driven myself crazy with an odd intermittent problem.

I have an intranet site, a good size one at that, on a Windows 2000 Server,
running Apache, connecting to another Windows 2000 Server running SQL Server
2000. It all works just peachy, and life is good.

But (there is always a but).

Now and then, I get a Query Failed message. I cannot find the source of
the problem, no matter how hard I try. I can't even find an error message,
which is really odd.

The query looks like this (it is a dynamic query, so it can change):
SELECT PhaseFK FROM Facts WHERE (CategoryFK=5)

The message I get back looks like this:
Warning: mssql_query(): Query failed in runsql.php on line 10

I tried looking at the following to get an error message:
mssql_query(SELECT @@ERROR as ErrorCode);  (it returns nothing)
mssql_get_last_message (it returns nothing, OR, sometimes it tells me that
it changed the database context)

What I think might be going on (because it ONLY happens with certain tables)
is that the table is locked (there are some external processes that work
with this table, which fire off more or less randomly from my code's point
of view) or is other unavailable for some reason which eludes me. But I
can't seem to figure out how to tell if this is the case or not.

It seems to me that if I get a Query Failed then somewhere lurks an error
code, and thus I can trap it nicely, instead of simply failing (that bugs me
from a user point of view).

Any thoughts?
Thanks!
david

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SQL Server Query Failed

2004-03-17 Thread Bruno Ferreira
david wrote:

Hello there!

I have just about driven myself crazy with an odd intermittent problem.
[snip]
 

   I'd first start by turning on all logging I could in the SQL server 
so that I could see what's happening straight from the horse's mouth...

   Bruno Ferreira
---
[This E-mail scanned for viruses by Declude Virus]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] SQL Server Query Failed

2004-03-17 Thread Robert Twitty
What type of field is PhaseFK?

-- bob

On Wed, 17 Mar 2004, david wrote:

 Hello there!

 I have just about driven myself crazy with an odd intermittent problem.

 I have an intranet site, a good size one at that, on a Windows 2000 Server,
 running Apache, connecting to another Windows 2000 Server running SQL Server
 2000. It all works just peachy, and life is good.

 But (there is always a but).

 Now and then, I get a Query Failed message. I cannot find the source of
 the problem, no matter how hard I try. I can't even find an error message,
 which is really odd.

 The query looks like this (it is a dynamic query, so it can change):
 SELECT PhaseFK FROM Facts WHERE (CategoryFK=5)

 The message I get back looks like this:
 Warning: mssql_query(): Query failed in runsql.php on line 10

 I tried looking at the following to get an error message:
 mssql_query(SELECT @@ERROR as ErrorCode);  (it returns nothing)
 mssql_get_last_message (it returns nothing, OR, sometimes it tells me that
 it changed the database context)

 What I think might be going on (because it ONLY happens with certain tables)
 is that the table is locked (there are some external processes that work
 with this table, which fire off more or less randomly from my code's point
 of view) or is other unavailable for some reason which eludes me. But I
 can't seem to figure out how to tell if this is the case or not.

 It seems to me that if I get a Query Failed then somewhere lurks an error
 code, and thus I can trap it nicely, instead of simply failing (that bugs me
 from a user point of view).

 Any thoughts?
 Thanks!
 david

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php