I changed the mssql_select_db line as suggested by another person here
but it didn't change a thing. I still get the exact same error message.
Is there anyone else here connecting to a MS SQL server using TDS v8.0
??
Thanks!
Jason
-Original Message-
From: Jason Morrill [mailto:[EMAIL PROTECTED]
Sent: Friday, March 12, 2004 8:36 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP - MSSQL connects, but can't query
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:
sql-test.php
html
body bgcolor=white
?php
$dbproc = mssql_connect(roger,sa,admin);
#$dbproc = sybase_connect(roger,sa,admin);
if (! $dbproc) {
print Can't connect to server;
return;
}
print Connected to server.;
$dbconnect = mssql_select_db(Northwind);
if (! $dbconnect) {
print Can't connect to Northwind;
return;
}
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;
return;
}
print Connection closed.;
?
/body
/html
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?!
Thanks!
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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php