• Hey guys,
    I’m quiet new to WordPress and web development in general.
    For my new project I need to implement a table, in which the cell containing the highest value per row is automatically marked with a colour. The user should also be able to mark a cell manually. Furthermore each marked cell per column should count as numerical value 1, so I can do further calculations with these values.
    Not sure how this could be done. Is there a plugin for such a function?

    Thanks a lot in advance
    Greetings
    Saib0t

Viewing 4 replies - 16 through 19 (of 19 total)
  • 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.

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Implement an interactive table marking the highest value’ is closed to new replies.