Skip to content

Instantly share code, notes, and snippets.

@danielkwok21
Last active September 2, 2017 11:45
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 danielkwok21/753760092965e9a06a217a19d7c196a4 to your computer and use it in GitHub Desktop.
Save danielkwok21/753760092965e9a06a217a19d7c196a4 to your computer and use it in GitHub Desktop.
php connection for potato
<?php
function opencon(){
$dbhost = "localhost";
$dbuser="root";
$dbpass=/*"insert your password here"*/;
$db=/*"insert your database name here. Mine's potato"*/;
$conn = new mysqli($dbhost, $dbuser, $dbpass, $db) or die("Connection failed: %s \n". $conn->error);
return $conn;
}
function closecon($conn){
$conn->close();
}
?>
<?php
include 'db_connection.php';
$conn = opencon();
echo "Connected Successfully";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment