Jump to content

SQL connection


ngreenwood6

Recommended Posts

Thanks for the reply.I have tried this code:

 

<?php
// Server in the this format: <computer>\<instance name> or 
// <server>,<port> when using a non default port number
$server = 'myserver\myinstance';

$link = mssql_connect($server,'username','password') or die("Cant Connect");

mssql_select_db("database_test");

$query = "SELECT * FROM dbo.users";

$results = mssql_query($query, $link) or die("invalid query");

while($row = mssql_fetch_array($results))
{
echo $row['first_name'] . " " . $row['last_name'];
echo "<br>";
}
?> 

 

I have removed my server, username, and password for obvious reasons. I know that the server is connectable because I can connect to it with VB. I have even tried using just the server. No luck on either side. I am getting this error:

 

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: myserver\myinstance in C:\wamp\www\mssql.php on line 6

Link to comment
https://forums.phpfreaks.com/topic/140902-sql-connection/#findComment-737629
Share on other sites

i was using my ip address lol. I tried it with the ipaddress like "192.168.1.100" and with the instance after "192.168.1.100\MySQLExpress". It is a remote connection and before anyone says something that is not the ip address that I was using. my external ip address is different but didn't want to post it. I will try it internally later but I can connect to the server remotely using vb so I wouldn't think that would matter.

Link to comment
https://forums.phpfreaks.com/topic/140902-sql-connection/#findComment-737755
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.