PHP wont parse files where I make odbc_connects

Running Ubuntu 8.04, PHP 5.2.4 and remotely connecting to a Windows SQL 2005 Server.

My script in test.php


$connect = odbc_connect("SQLSERVER", "user", "pass");
$query = "SELECT CAST(heading AS TEXT) AS heading FROM dokument";
$result = odbc_exec($connect, $query);

while(odbc_fetch_row($result)) {
$field1 = odbc_result($result, 1);
$field2 = odbc_result($result, 2);
print("$field1 $field2
");
}

odbc_close($connect);

When i open this in Firefox I get asked if i want to download the test.php file. Now, all other phpfiles work just fine, so there shouldnt be anything wrong with the php or apache configuration file.

Now, here’s an interesting detail. If I change the name of the field (“heading”) to like “heeeeading” (which doesnt exist), I get this error:

Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid column name ‘heeeeading’., SQL state S0022 in SQLExecDirect in /var/www/www.(dont want this in google).no/temp/test.php on line 52

Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in /var/www/www.(dont want this in google).no/temp/test.php on line 55

Any ideas? I cant find anything that helps me specifically with this, on any other forum I’ve looked at. :stare: