how to connect database on php command code example
Example 1: php sql server connect
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"userName", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
Example 2: mysql db connection in php
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";
$conn= mysqli_connect($servername,$username,$password,$dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected Successfully.";
?>