I am trying to connect to an MS SQL database using the following PHP code:
$hostname_conn_iShore = "220.127.116.11";
$database_conn_iShore = "database_name";
$username_conn_iShore = "username";
$password_conn_iShore = "password";
$conn_iShore = mssql_connect($hostname_conn_iShore, $username_conn_iShore, $password_conn_iShore);
However, I am getting an Internal Server Error (500).
Any ideas why?
500 means there was a PHP error. Can you post that error form your logs?
It is likely that you gave 3 params instead of 4 (you missed the DB name)
Also, putting "_iShore" at the end of var names is something I bet you will regret. Why not simply do:
$db_con = mssql_connect("18.104.22.168", "database_name", "username", "password");
Tried adding the database name but got same error. Also, I cant post error logs as this is on a shared server.
Please refer - http://php.net/manual/en/function.mssql-connect.php
i think you don't have to provide database name as the syntax say
resource mssql_connect ([ string $servername [, string $username [, string $password [, bool $new_link ]]]] )