I am currently trying to create a new database in my Wordpress MySQl database to store information. I am running into issues connecting with the database and extracting the data to be displayed on a page. I imported some data into the database through phpMyAdmin. My php to connect to the Wordpress database was:
$servername = "servername";
$username = "username";
$password = "password";
$dbname = "dbname";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: ".$conn->connect_error);
}
echo "Connected successfully";
For the appropriate username and password I went into my wp-config.php file. I was having ussues finding the servername for the connection. When I used the Server Hostname found in my cPannel it would print connected successfully on my localhost server but I wasn't able to extract the data.
Thanks for the help!