Welcome Guest, Not a member yet? Register   Sign In
Need Idea foreach
#2

(This post was last modified: 04-25-2018, 11:06 PM by neuron.)

where your getting data from?
if this data in database you can use group by and sum sql functions to get

viewed | code
25        | US
85        | SG
55         | MY

or if discribe it in php array: 
PHP Code:
array(
 
 array('viewed' => 25'code' => 'US'),
 
 array('viewed' => 85'code' => 'SG'),
 
 array('viewed' => 55'code' => 'MY')




your gdpData is in json format. you will need to map to 


PHP Code:
array(
 
   'US' => 25,
 
   'SG' => 85,
 
   'MY' => 55

 this format and then use json_encode PHP function. it will give following result:

{"US":25,"SG":85,"MY":55}

Also to parse json you can use json_decode function in PHP
Reply


Messages In This Thread
Need Idea foreach - by googlemy - 04-25-2018, 05:44 PM
RE: Need Idea foreach - by neuron - 04-25-2018, 11:05 PM
RE: Need Idea foreach [Solved] - by googlemy - 04-26-2018, 12:19 AM
RE: Need Idea foreach - by syedamirbukhari - 05-02-2018, 11:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB