Connecting to SQL

I’m attempting to use the following code to connect to a SQL database on another domain from within a PHP hosted domain. I don’t get any errors, in fact I don’t get anything. Page source shows nothing. Any idea what’s going on?

<?php $serverName = "an ip address like 50.35.24.59"; $connectionInfo = array( "Database"=>"databasename", "UID"=>"userid", "PWD"=>"password"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn ) { echo "Connection established.
"; }else{ echo "Connection could not be established.
"; die( print_r( sqlsrv_errors(), true)); } ?>

You don’t need to use an array, but if you want to, it would be used like
[php]

<?php $serverName = "an ip address like 50.35.24.59"; $cI = array( "Database"=>"databasename", "UID"=>"userid", "PWD"=>"password"); mysql_connect($serverName, $cI['UID'], $cI['password']); mysql_select_db($cI['Database']) or die(mysql_error()); ?>[/php]I shortened the connection array because its easier to type, just replace what i typed with yours.

The previous code is absolutely not going to work. The OP is trying to connect to a Microsoft SQL Server.

rhen idk, google might know.

Sponsor our Newsletter | Privacy Policy | Terms of Service