0

Hi, im am having a smal issue whereby i am using a highchart api based on jquery to display stats. but the stats are stored statically in a table in html and throught which the graph are shown. Nnow i implemented php/mysql to get the data directly from db. So im having a while loop that will generate the table name, so how can i change the code in the jQury to accept each table name in order to display the info
Thank you

 var table = document.getElementById('datatable'),//<!-- nee to change here
        options = {
            chart: {
                renderTo: 'container',
                width:1100,
                type: 'column'
            },

My php code in the while loop

while($row_online_stats=mysql_fetch_array($rsl_online_stats))
        {

        echo'
        <div id="'.$row_online_stats['Name'].'" style="display:none"></div>
        <article class="module width_full">
            <header><h3>Stats for '.$row_online_stats['Name'].'</h3></header>
            <div class="module_content" id="'.$row_online_stats['Name'].'" style="margin:0 auto">

            </div>
        </article>
        <table class="table_stats" id="'.$row_online_stats['Name'].'">
    <thead>
        <tr>
            <th></th>
            <th>Jane</th>
            <th>Dave</th>
            <th>John</th>
        </tr>
    </thead>

Edited by peter_budo: JSP stands for Java Server Pages, post moved to JavaScript section

2
Contributors
1
Reply
3
Views
4 Years
Discussion Span
Last Post by EvolutionFallen
0

If I understood you correctly, maybe this will help:

$('.tables_stats').each(function() {

    var table_name = $(this).attr('id');

    switch(table_name) {
        case "[table_id_here]": // change to the table name you're checking for
            run_a_fcn();
            break;
        // etc.
    }
});

Hope that helps.

~ EF

Edited by EvolutionFallen

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.