Skip to Content.
Sympa Menu

freetds - [freetds] tsql works but php does not?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Bing Du" <bdu AT iastate.edu>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] tsql works but php does not?
  • Date: Fri, 18 Nov 2005 16:44:05 -0600 (CST)

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




Archive powered by MHonArc 2.6.24.

Top of Page