Connecting an HTML webpage to a SQL Server



PHP Snippet 1:

ini_set('display_errors',1);
error_reporting(E_ALL);

//and
if (!$mysql) {
    die('Could not connect: ' . mysql_error());
}

PHP Snippet 2:

<!DOCTYPE html>
<html>

<head>
  <link rel="stylesheet" type="text/css" href="Style.css">
</head>
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$host="myname.database.windows.net";
$username="theUser";
$password="password";
$database="databaseName";
$tbl_name="tableName";

$mysql = mysql_connect($host, $username, $password)or die("cannot connect"); 
if (!$mysql) {
    die('Could not connect: ' . mysql_error());
}
mysql_select_db($database);
$sql='SELECT * FROM $tbl_name';
$result=mysql_query($sql); 

?>