[freetds] tsql works but php does not?
Bing Du
bdu at iastate.edu
Fri Nov 18 17:44:05 EST 2005
Hello,
Freetds-0.63 installed. TSQL can connect to the MS SQL server and pull
the data out fine. But the following php script returns nothing either on
command link or in web browser. No error messages even. What am I
missing? Thanks in advance for any help.
==
<?php
// connect to database server
$db_conn = mssql_connect("MyServer2k","user","pass")
or die( "<strong>ERROR: Connection to mssql failed</strong>" );
// select database - only if we want to query another database than the
default one
mssql_select_db( "somedb", $db_conn )
or die( "<strong>ERROR: Selecting database failed</strong>" );
// query the database
$query_result = mssql_query( "SELECT * FROM somedb", $db_conn )
or die( "<strong>ERROR: Query failed</strong>" );
/*
* You can now access the result data by using the appropriate
mssql_xxx() functions
* on $query_result. See the PHP manual section on Microsoft SQL Server
functions
* for documentation on how to do this.
*/
mssql_free_result( $query_result ); // unnecessary in PHP 4
mssql_close( $db_conn ); // unnecessary in PHP 4
?>
==
/usr/local/etc/freetds.conf
==
...
[MyServer2k]
host = mssql.some.edu
port = 1433
tds version = 8.0
dump file = /tmp/freetds.log
dump file append = yes
...
==
Bing
More information about the FreeTDS
mailing list