I have a PHP Sql results, table looks like:
It appears as:
[id]|test1|data|voice
1|0|0|-1
2|0|1|0
3|0|-2|-1
Print_r of the ar
Considering your source array name as $Arr , Try out below code
foreach($Arr as $valArr)
{
$index = 0;
foreach($valArr[0] as $k => $v)
{
$newArr[$index]["name"] = $k;
$newArr[$index]["val"][ ] = $v;
$index++;
}
}
echo "<pre>"; print_r($newArr);
use this and do modifications if neded
SELECT *
FROM `table_name`
GROUP BY `test1` , `data` , `voice`
LIMIT 0 , 30