coonect ot MSSQL 7.0

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
cade
Forum Commoner
Posts: 55
Joined: Tue Jul 03, 2007 8:18 pm

coonect ot MSSQL 7.0

Post by cade »

I figure out from my coding style using ms_sql_connect fail to connect to server. I supplied the ip of the server. What am I missing?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Asking Smart Questions

Post by feyd »

[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2.1. When asking a question, be as specific as you can be, provide the relevant code and any other information that is helpful in a concise and coherent manner. If you are not sure how to do that, read these guidelines.
cade
Forum Commoner
Posts: 55
Joined: Tue Jul 03, 2007 8:18 pm

Post by cade »

Code: Select all

$myServer = "202.157.***.***";
$myUser = "vmadmin1";
$myPass = "vmsql15062002111";

$s = mssql_connect($myServer, $myUser, $myPass) or die("Unable to connect to server: $myServer");
$myDB = "vmtmx";
$d = mssql_select_db($myDB, $s) or die("Unable to connect to database: $myDB");
I don't know what is wrong with this code. Can somebody help me.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

What leads you to believe it's not working?
cade
Forum Commoner
Posts: 55
Joined: Tue Jul 03, 2007 8:18 pm

Post by cade »

when I try and it show error to connect
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

There error being...?
cade
Forum Commoner
Posts: 55
Joined: Tue Jul 03, 2007 8:18 pm

Post by cade »

I believe the problem is on the server side...However I have checkd the PHP.ini setting. I don't know what makes my codes could not connect to the server
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

What. Is. The. Error? Please make sure to post the full error.
cade
Forum Commoner
Posts: 55
Joined: Tue Jul 03, 2007 8:18 pm

Post by cade »

Code: Select all

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: 202.***.***.220 in C:\xampp\htdocs\jobvm2\js_form.php on line 88
is there any idea? Thanks in advance
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Have you looked at what mssql_get_last_message() returns?
cade
Forum Commoner
Posts: 55
Joined: Tue Jul 03, 2007 8:18 pm

Post by cade »

I already tested the get last message. But it didn't work. The message was: unable to connect to 202.***.**.***. I already set up the MS SQL network utility to 1433. And telnet to it and the reply is success. I also checked my php info and everything was setup accordingly. Do you have any idea waht's cause this?
cade
Forum Commoner
Posts: 55
Joined: Tue Jul 03, 2007 8:18 pm

Post by cade »

Ok...it's my mistake for placing the IP and port number like this

202.XX.XXX.X: 1433.

it should be 202.XX.XXX.X, 1433....

More details on: http://amin2u.blogspot.com/2007/07/call ... nnect.html
Post Reply