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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.