i have table in mysql, i used php to get each column as an array, how can i use these arrays to create a chart? - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Sunday, March 6, 2022

i have table in mysql, i used php to get each column as an array, how can i use these arrays to create a chart?

these values, "$result" contains the whole table. "$rows" is just storing how many rows in the table. i've tried using chartjs but i couldn't figure out how to put my arrays as (data), it seemed i have to manually put the content of the arrays, which is counter-intuitive.

$deathcolumn = array();
    $datecolumn = array();
    for($j=0; $j < $rows; ++$j){ // try to get one column in an array
      $result->data_seek($j);
      $deathcolumn[$j] = $result->fetch_assoc()['deaths'];
        $result->data_seek($j);
        $datecolumn[$j] = $result->fetch_assoc()['date'];


source https://stackoverflow.com/questions/71364723/i-have-table-in-mysql-i-used-php-to-get-each-column-as-an-array-how-can-i-use

No comments:

Post a Comment