Home | Troubleshooting |  Quick Setup  |  Cisco How to  |  Data Recovery  |  Forums   | Blog | IT Exam Practice | Services  | About Us | Chicagotech MVP  | Search  | Contact Us  |                 

 

 

How to create a PHP script to test SQL connection

 

If you need to query SQL database from a website and need to test the connection, you can create PHP script to test it. Here are the example.

Save it as test.php and run this command php.exe test.php.

 

  <?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
$username = 'myname';
$password = 'mypassword';
$server = '1mysqlserver';

echo "connecting to server: $server \n";

$link = mssql_connect($server, $username, $password);

echo "link? \n";


if (!$link) {
# die('Something went wrong while connecting to MSSQL');
echo "failed to connect \n\n";
} else {
echo "successful connection \n\n";
}
?>

 



Post your questions, comments, feedbacks and suggestions

Contact a consultant

Related Topics


 

 


 

 

Hit Counter   This web is provided "AS IS" with no warranties.
Copyright © 2002-2018 ChicagoTech.net, All rights reserved. Unauthorized reproduction forbidden.