danni web has been a great help to me i want just one more help

i am able to connect to MSSQL present in my localhost using wamp

but i am unable to connect to my MSSQL running in a pc with ip 123.xxx.xxx.xxx

can u guide me on how to connect to it..!

thanx in advance

Recommended Answers

All 8 Replies

do your sql manager supports ssh

How to check that sir ?

oops , you can simply connect it using the connect function like below -

$con = mssql_connect($server_name,$username,$password);
$db_select = mssql_select_db($database_name);

you must have understood that, in the mssql_connect function, you need to provide the server's name at first parameter and so on.
put that ip there and it should work.

You may Use the Belwo Specified Code:

$hostname = "123.xxx.xxx.xxx"; // usually is localhost, but if not sure, check with your hosting company, if you are with webune leave as localhost 
$db_user = "username"; // change to your database password 
$db_password = "password"; // change to your database password 
$database = "database_name"; // provide your database name 

# STOP HERE 
#################################################################### 
# THIS CODE IS USED TO CONNECT TO THE MSSQL DATABASE 
$db = mssql_connect($hostname, $db_user, $db_password);
mssql_select_db($database,$db); //Database Connect

EDIT: Sorry Code Edited for Some Error.

he wants to connect to the microsoft's SQL server and not MySQL

Sorry Friend.

am Edit my Code.

Thanx for Your Suggestion.

hey i hope you have got you answer. its so useful postings.

Thanx a Lot guys !! U all ROCK :*:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.