Skip to content

Instantly share code, notes, and snippets.

@ayoubbensakhria
Created August 4, 2020 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayoubbensakhria/8e16799462af91465699a28493ba88f7 to your computer and use it in GitHub Desktop.
Save ayoubbensakhria/8e16799462af91465699a28493ba88f7 to your computer and use it in GitHub Desktop.
<h1>Hello World!!!</h1>
<h4>Attempting MySQL connection from php...</h4>
<?php
// I assume that you've created a new username 'user' with password 'user' for a demo purpose
$host = 'mysql';
$user = 'user';
$pass = 'user';
$conn = new mysqli($host, $user, $pass);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
} else {
echo "Connected to MySQL successfully!";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment