Create a gist now

Instantly share code, notes, and snippets.

@ulyssesr /connect.php Secret
Last active Mar 17, 2017

What would you like to do?
Simple PHP Script to connect to MySQL
<?php
$username = "user";
$password = "password";
$hostname = "hostname";
$database = "database";
$dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL");
echo "Successfully Connected to the MySQL Database.<br/>";
$selected = mysql_select_db("$dbname", $dbhandle) or die("Could not select database");
echo "Successfully Connected to Database called: $database";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment