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>

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.