I've got a very simple PHP script for testing my MS SQL Server
connection. I've installed FreeTDS and I can connect and query the
database with TSQL.

With PHP I can connect and disconnect properly but I can't query or
attach to different databases. Here is my sample PHP followed by what
the web server throws back at me:


<body bgcolor=white>
$dbproc = mssql_connect("roger","sa","admin");
#$dbproc = sybase_connect("roger","sa","admin");
if (! $dbproc) {
        print "Can't connect to server";
print "Connected to server.";

$dbconnect = mssql_select_db("Northwind");
if (! $dbconnect) {
        print "Can't connect to Northwind";
print "Connected to database";

#$res = sybase_query("select * from test",$dbproc);
#if (! $res) {
#       return;
#while ($arr = sybase_fetch_array($res)) {
#       print $arr["i"] . " " . $arr["v"] . "<br>\n";

if (! mssql_close($dbproc)) {
        print "Can't close server connection";
print "Connection closed.";


Output in browser when referencing the sql-test.php file:

Connected to server.
Warning: Sybase: Server message: Line 1: Incorrect syntax near 'e'.
(severity 15, procedure N/A) in /home/www/sql-test.php on line 12
Can't connect to Northwind


Can anyone help me figure this one out?!

 Jason Morrill
 IT Manager
 Child & Family Agency SE Connecticut 

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

Reply via email to