-
SQL Connection issues
I'm having issues connecting to an sql server and was wondering if anybody knew anything about it.
I was told to connect to the server on a certain port, so here is what I did in php:
PHP Code:
$user_server="username";
$password_server="...";
$database_server=".......";
$sql_server="somesite.com:port";
mysql_connect($sql_server,$user_server,$password_server);
echo 'Test';
Now, for some reason, when I run this code, nothing gets outputted, the page just sits there for about 30 seconds, and then just says "Done" at the bottom. I'm guessing that it is timing out or something, and that for some reason if the mysql_connect command times out, my whole script just stops running.
I think the problem could be arising from the fact that I'm using mysql to connect to a SQL2000 database, but I don't know enough about the two and have never connected to databases that weren't on my website before.
Any help would be appreciated, thanks.
-
You will only be able to connect to the db with a SQL2000 API. MySQL won't work.
-
$hit...then how do I go about connecting to it? I need to be able to do this for a job and it needs to be done for tomorrow or I won't get payed :eek:
hmm, I guess this is more of a question I need to aim at my host.
-
You're trying to connect to a Microsoft SQL server using MySQL functions. That's like calling your local library and speaking chinese (unless you live in China).
You'll want to use something like this:
PHP Code:
mssql_connect ($sql_server, $user_server, $password_server)
Note mssql_connect as opposed to mysql_connect.
http://aspn.activestate.com/ASPN/doc...ref.mssql.html
-
Echo stovellp on this one. And make sure your host has enabled support for the library (in the php.ini file). Not many hosts set this up for you unless they're hosting the SQL2000 server.
I would also assume that you are correct in the way you tried to use the port, however that might be a setting elsewhere.
If you need more help, I work with PHP and an SQL2000 server every day (although on the default port).