table: |name|US|IN|SA|CHN|AU|EU|.......
|john|0 |12|2 |0 |1 |0 |.......
|andy|20|17|2 |10 |1 |0 |.......
I have a table with 200 columns having all countries. In them are the entries in integer of the number of clicks coming from each country. In order to display them in a geo chart I would like to parse these values in such a way as follows:
output:
IN,12
SA,2
AU,1
such that I would like to exlude those countries that have 0 clicks and grouped by username john
Here is my method but it is incomplete..
$query = "SELECT * FROM `countries`";
$result = mysql_query("SHOW COLUMNS FROM `countries`.`graph_geo_table` WHERE Field NOT IN ('Name')");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
echo $row[Field];
}
}