Thread Starter
saib0t
(@saib0t)
Yea actually there is a die, for the case, that the connection failed. Taking it out doesn’t help. I used a plugin called Post Snippets. Code looks like this:
<?php
$dbh = mysql_connect("<em>Server</em>", "<em>Username</em>", "<em>Password</em>");
if (!mysql_query($query, $dbh)) die("Connection failed.");
$query = "use <em>DB-Name</em>";
?>
that code is going to throw an error regardless so it will die();
try this: (just a quick and dirty test);
if ( !defined('ABSPATH') ){ define('ABSPATH', dirname(__FILE__) . '/'); }
require_once(ABSPATH . 'wp-config.php');
global $wpdb;
$dbh = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$query = "SELECT * FROM wp_posts LIMIT 1";
if (!mysqli_query($dbh, $query)) die("Connection failed.");
print_r( $wpdb->get_results($query));
Thread Starter
saib0t
(@saib0t)
Well at least I get a “Connection failed” now, instead of an empty page. I used the data I got from my host, to connect to the database. Just to make things clear: I’m not talking about the data base that WordPress depends on anyways, but a seperate one storing data, which, later on, should be displayed in the table.
lol, aight, then remove this: if (!mysqli_query($dbh, $query)) die("Connection failed."); and see if the table shows properly. If so, then it’s the die() in you failed connection.