Friday, 6 September 2013

How can I parse the following Array with php?

How can I parse the following Array with php?

string: [Name] => google [AF] => 0 [AX] => 2 [AL] => 1 [DZ] => 0 .....
output:
[AX,2]
[AL,1]
the countries with [0] entries are being excluded in the list
I have tried using sql but i want for php
Select '[AF,' + LTrim(Cast(Sum(AF) as varChar(5))) + ']'
From Table Where name = 'Andy'
Union
Select '[AS,' + LTrim(Cast(Sum(AS) as varChar(5))) + ']'
From Table Where name = 'Andy'
Union
Select '[AQ,' + LTrim(Cast(Sum(AQ) as varChar(5))) + ']'
From Table Where name = 'Andy'
and also http://sqlfiddle.com/#!2/42756/5
but i need in php

No comments:

Post a Comment