Last active
October 4, 2017 04:59
-
-
Save boazcstrike/9bf8abd55b8d8daef6cad4e3ffd9c193 to your computer and use it in GitHub Desktop.
establish a connection for your sql database and select the database initially
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 | |
//SQL CONNECTION | |
$url = ''; | |
$db_user = ''; | |
$db_pass = ''; | |
$db = ''; | |
$conn = mysqli_connect($url, $db_user, $db_pass, $db); | |
if(!$conn){ | |
echo "<center>Connection not established, please check your code.<br>"; | |
echo "<br>Debugging errno: " . mysqli_connect_errno() . PHP_EOL; | |
echo "<br>Debugging error: " . mysqli_connect_error() . PHP_EOL; | |
}else{ | |
// echo "Connected to " . $url . " " . $db_user . " " . $db . " " ; | |
mysqli_query($conn, "USE $db;"); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment