Created
January 16, 2020 19:21
-
-
Save fernandokosh/f359bc8e4cf553703687cfde2e647fe3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
// WordPress database connection test usingo mysqli | |
// Enable all messages | |
ini_set('display_errors', 1); | |
ini_set('display_startup_errors', 1); | |
error_reporting(E_ALL); | |
$conn = mysqli_connect('localhost', 'username', 'password'); | |
mysqli_select_db($conn, "my_wordpress_database"); | |
if (!$conn) { | |
die('ERROR: Unable to connect: ' . mysql_error()); | |
} | |
echo 'Connected to the database.<br>'; | |
$result = mysqli_query($conn, 'SELECT user_login FROM wp_users'); | |
$row = mysqli_fetch_row($result); | |
echo "User : ", $row[0], "<br>\n"; | |
mysqli_close($conn); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment