I created a script to perform a few select queries on a mssql database, but the script seems to stop dead on certain queries, without returning any errors. The browser receives a completely empty response from the server. On Firefox, it prompts to download a blank .php file; on Chrome it returns "Error 324 (net::ERR\_EMPTY\_RESPONSE): Unknown error."; and on IE8 it returns "Page cannot be displayed".

The query is

```
$sql = "SELECT *
    FROM EmployeeHours
    WHERE (EmployeeId = '".$staff_id."')
    AND (TimeIn > DATEADD(second, ".$week_start.", CONVERT(DATETIME, '1970-01-01', 102)))
    AND (TimeOut < DATEADD(second, ".$week_end.", CONVERT(DATETIME, '1970-01-01', 102))
        OR TimeOut IS NULL)
    ORDER BY UTCDateAdded DESC";
$query = mssql_query($sql);

```

$staff\_id is a simple int. $week\_start and $week\_end are unix timestamps. 

I don't think it's the query itself, because it runs fine in MSSQL Server Management Studio and returns the correct data. I can also simplify the query down to "SELECT TOP 1 \* FROM EmployeeHours" with no WHERE conditions and it still fails.

Setting error\_reporting to E\_ALL has no effect. It doesn't execute anything past the mssql\_query(). Anything printed or echoed before the query doesn't appear in the resulting file either.

I can verify that it is connected to the the correct database, because I can run some other queries on tables in the same database and get results through the script.