Hey I'm having some problems connecting to my database using php.
To connect to the database I am using this code:
When I run this code I get:Code:<?php $Conn = mssql_connect("The server","my username on the server","my password on the server") or die("ERROR connection server"); echo 'Connection to server etablished<br />'; $Db=mssql_select_db("the name of my database on the server",$Conn); if($Db){ echo '$Db is good<br /><br />'; $query = mssql_query("SELECT * FROM player"); echo 'Query is good :) There are '.mssql_num_rows($query).' records<br />'; mssql_close($Conn); } else{ echo 'ERROR connection DB<br />'; } ?>
ERROR connection serverPHP Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: ***** in ***\wwwroot\Ratefootball\databaseworking.*** on line 5
Now unless I have the servername/username/password incorrect does that code look like it should work? Also in coldfusion you set up a DSN is that required in PHP or is this code all that is needed?
If you do need a dsn is there a way to create/access it on a pc which doesnt give you access to control panel?




Bookmarks