Last active
September 2, 2017 11:45
-
-
Save danielkwok21/753760092965e9a06a217a19d7c196a4 to your computer and use it in GitHub Desktop.
php connection for potato
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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