Hi!
I trying connect to mssql2005 express edition from my code in Visual Studio 2005.
But I get error
Unable to connect to server: localhost in D:\Work\Project\PHP\WM9\WM9\index.php on line 3
Code:


<?php

$cnn = mssql_connect('localhost','user','password');
if(!$cnn)
{ echo("<P>MSSQL Server is not connected!</P>");
return false;
}

Connection parameters is valid! What problem is there ?
Thanks!

VladimirM says:

I'm trying connect to local MySQL database.
It does not work!
Result is fail too :(((
I think I have incorrect setting in my IDE VS2005.
But I don't know what

chichibek says:

visit this post

http://www.jcxsoftware.com/jcx/node/1446

Use Php5
On September 4th, 2006 webmaster said:

Select the Php5 runtime configuration and try again. Go to the solution node in the solution explorer and select Php5 in the platform selection box in the toolbar.

Let me know if that works for you.

estergon says:

<?php
$dbhost
= "localhost";
$dbuser = "root";
$dbpass = "";
$dbname = "Your Database Name";

$connection = @mysql_connect($dbhost,$dbuser,$dbpass);
if(!
$connection){
echo
"MYSQL DATABASE CONNECTION ERROR ".mysql_error();
}
@
mysql_select_db($dbname,$connection);
if(!
mysql_select_db){
echo
"DATABASE SELECTION ERROR " .mysql_error();
}
?>

RealityMasque says:

I got vs.php 2.6 for vs2008 -- couldn't install.
I got vs.php 2.6 for vs2005 -- installed. Took a about 5 hrs trying to get an existing site to debug, to no avail. Co-worker had vs.net 2.5 for vs2005 installed, so I put all the files in our company's svn, he got it, & debugging worked.
I uninstall vs.php 2.6 for vs2005 (tried to provide feedback, but the feedbakc page said I'd already provided feedback, even though it was my 1st time) & install vs.php 2.5 for vs2005. Install works, I'm able to debug, but I get the mssql_connect error.
I know the IP address, username, & password work, as they are the same as what the live website uses. I've tried selecting the Php5 runtime configuration, but I get the same error. I tried adding vs.net & apache as exceptions to my computer's firewall, but get the same error. Here's what comes up:

( ! ) Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: 62.8.97.92 in C:\Documents and Settings\orcu\My Documents\Visual Studio 2005\Projects\InPracticeDev\InPracticeDev\config\phpcoder_db.lib.php on line 9
Call Stack
# Time Memory Function Location
1 0.2658 77296 {main}( ) ..\index.php:0
2 0.2915 130808 require_once( 'C:\Documents and Settings\orcu\My Documents\Visual Studio 2005\Projects\InPracticeDev\InPracticeDev\config\phpcoder_all.lib.php' ) ..\index.php:2
3 0.3072 201328 include( 'C:\Documents and Settings\orcu\My Documents\Visual Studio 2005\Projects\InPracticeDev\InPracticeDev\config\phpcoder_db.lib.php' ) ..\phpcoder_all.lib.php:2
4 0.3172 202312 mssql_connect ( ???, ???, ??? ) ..\phpcoder_db.lib.php:9

( ! ) Warning: mssql_select_db() [function.mssql-select-db]: Unable to connect to server: (null) in C:\Documents and Settings\orcu\My Documents\Visual Studio 2005\Projects\InPracticeDev\InPracticeDev\config\phpcoder_db.lib.php on line 10
Call Stack
# Time Memory Function Location
1 0.2658 77296 {main}( ) ..\index.php:0
2 0.2915 130808 require_once( 'C:\Documents and Settings\orcu\My Documents\Visual Studio 2005\Projects\InPracticeDev\InPracticeDev\config\phpcoder_all.lib.php' ) ..\index.php:2
3 0.3072 201328 include( 'C:\Documents and Settings\orcu\My Documents\Visual Studio 2005\Projects\InPracticeDev\InPracticeDev\config\phpcoder_db.lib.php' ) ..\phpcoder_all.lib.php:2
4 21.4323 202832 mssql_select_db ( ??? ) ..\phpcoder_db.lib.php:10

( ! ) Warning: mssql_select_db() [function.mssql-select-db]: A link to the server could not be established in C:\Documents and Settings\orcu\My Documents\Visual Studio 2005\Projects\InPracticeDev\InPracticeDev\config\phpcoder_db.lib.php on line 10
Call Stack
# Time Memory Function Location
1 0.2658 77296 {main}( ) ..\index.php:0
2 0.2915 130808 require_once( 'C:\Documents and Settings\orcu\My Documents\Visual Studio 2005\Projects\InPracticeDev\InPracticeDev\config\phpcoder_all.lib.php' ) ..\index.php:2
3 0.3072 201328 include( 'C:\Documents and Settings\orcu\My Documents\Visual Studio 2005\Projects\InPracticeDev\InPracticeDev\config\phpcoder_db.lib.php' ) ..\phpcoder_all.lib.php:2
4 21.4323 202832 mssql_select_db ( ??? ) ..\phpcoder_db.lib.php:10
Database in_practice_testsite can't be selected.

I'm not sure why the mssql_connect won't work, but I'd appreciate some help.

- O8