0

I have this data in my summary table:

REGIS_ID    VAC_NAME    LOC_DETAIL
1   Flu University
2   Flu University
3   Flu University
4   Flu Office
5   Flu School
6   Flu Office
7   Flu School
8   Flu School
9   Flu School
10  Flu School
11  Flu University
12  Flu University
13  Hepatitis-B School
14  Hepatitis-B School
15  Hepatitis-B School
16  Hepatitis-B Office
17  Hepatitis-B Office
18  Bird_Flu    University
19  Bird_Flu    University
20  Bird_Flu    School
21  Bird_Flu    School
22  Bird_Flu    School
23  Bird_Flu    Office
24  Bird_Flu    Office
25  Bird_Flu    University

so I want to query and transform data to PHP like this:

$dataTest = "['', 'Bird_Flu', 'Flu', 'Hepatitis-B'],
['School', 3, 5, 2],
['University', 3, 5, 3],
['Office', 2, 2, 2]";

in order to make a Google Chart:

Google Chart

What should I do? Thank you so much.

Peter David Carter
  • 2,548
  • 8
  • 25
  • 44
NPS
  • 9
  • 2

1 Answers1

0

I did a similar thing in the past, I just used code to build up the string in the required format

//sudo code
$dataTest = ""
foreach(datarow)
{
    $dataTest += "['School', 3, 5, 2],"
}
gvperkins
  • 168
  • 2
  • 9