Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server IP : 192.168.137.4
- Windows Authentication : Windows Authentication
- UserName : DELL-M102Zdell
- Database : DataProd
- Network Protocol : <default>
- Product Name : Microsoft SQL Server Express Edition
- Server Name : DELL-M102ZSQLEXPRESS
- Instance Name : SQLEXPRESS
- Computer Name : DELL-M102Z
- $serverName = "DELL-M102ZSQLEXPRESS"; //serverNameinstanceName
- $username = "DELL-M102Zdell"; //serverNameinstanceName
- $conn = mssql_connect( $serverName,$username,'');
- 1. make sure you have allow network connection from sql server configuration tool
- 2. allow connection for this port in firewall
- 3. activate sql browser service
- 4. make sure port is listen as the the service provide
- <?php
- $myServer = 'xxx.xxx.xxx.xxx:yyyy';
- $myUser = 'sa';
- $myPass = 'xxxxx';
- $con = mssql_connect($myServer, $myUser, $myPass) or die("Could not connect to database: ".mssql_get_last_message());
- if($con){
- echo "connected";
- }
- // Select a database:
- mssql_select_db('new')
- or die('Could not select a database.');
- // Example query: (TOP 10 equal LIMIT 0,10 in MySQL)
- $SQL = "SELECT TOP 10 * FROM Table";
- // Execute query:
- $result = mssql_query($SQL)
- or die('A error occured: ' . mysql_error());
- // Get result count:
- $count = mssql_num_rows($result);
- print "Showing $count rows:<hr/>nn";
- // Fetch rows:
- while ($Row = mssql_fetch_assoc($result)) {
- print $Row['BillNo'] . "n";
- }
- mssql_close($con);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement