ngreenwood6 Posted January 15, 2009 Share Posted January 15, 2009 Is there a way to connect to an SQL Express connection with php? If so any links or tutorials are helpful. Quote Link to comment Share on other sites More sharing options...
RussellReal Posted January 15, 2009 Share Posted January 15, 2009 ok.. mssql_connect however I looked up MS SQL EXPRESS and PHP on google and below are some links I've come across.. good luck http://www.interaktonline.com/Products/Free-Products/PHAkt/Product-Forum/Details/99999/MyNotes+-+Connection+Setup+to+MS+SQL+2005+Express.html?last=1 http://razasayed.wordpress.com/2008/03/09/connecting-to-sql-server-2005-express-using-php/ Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted January 15, 2009 Author Share Posted January 15, 2009 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 Quote Link to comment Share on other sites More sharing options...
RussellReal Posted January 15, 2009 Share Posted January 15, 2009 if it is a remote server connection, try using your IP, again I neverworked with mssql b4 so I hope this helps Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted January 15, 2009 Author Share Posted January 15, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.