0

Before I ask, I spent about 2 day searching and experimenting this stuff myself to make it work. Since I didn't have any luck, I am requesting help now.

PHP Code - Holds a recordset of last 30 days user signups count

$sql_last_30_days = "SELECT Count(username) as ttl_users, DATE_FORMAT(created, '%m%d%Y') as signup_day FROM tbl_users WHERE created >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) group by DAY(created) order by created desc";
$qry_30_days_users = mysqli_query($db_connection, $sql_last_30_days); 

I did while and foreach loops to try different options.

The above recordset is required to create a bar chart showing bars with sign up counts for the last 30 days.

Here is the javascript which creates the bar chart.

var data1 = [];
var i = 0;

   for (var i = 0; i <= 30; i += 1)
   data1.push([i, 25]);

    var ds = new Array();

            ds.push({
                data : data1,
                bars : {
                    show : true,
                    barWidth : 0.9,
                    order : 1,
                }
            });

I understand that the for loop and data1.push() needs the values supplied in order to populate the bar chart. But for some reasons, I can't figure out how to supply the PHP recordset values to this data1.push() function.

Any help will be highly appreciated.

Thank you

0 Answers0