crypatix
crypatix

Reputation: 55

Add data from a database to an array

I need to write a script that is able to search for a particular result, put it into a graph. I've already developed the graph. However, when hovered over the section of the graph, there would be a list of the data that is in that section.

Example:
25% of the pie chart is boys. When hovered over the boys, it will show a list of the names of the boys. In other words, i would need to be able to retrieve the multiple data from the database, put it in a list and echo out the results.


so far I've managed to code this:

$data = array();<br>
    while ($row = mysqli_fetch_array($result))<br>
    {<br>
    $data[]= $row;<br>
}<br>
echo "$data";

However I do not know what I'm echoing out. Please help me

Upvotes: 1

Views: 83

Answers (1)

Yang Yuan
Yang Yuan

Reputation: 176

i guess this is what you want do to...

$data = array();
while ($row = mysqli_fetch_array($result)) {
    array_push($data, $row);
}
print_r($data); // dump

Upvotes: 1

Related Questions