how can I save values in Arry's for each index? can I do it with Sql statement or loop? my mssql statement:
$statement = "SELECT DISTINCT cat_id,value FROM mydb where cat_id > '3000' and cat_id < '6000' order by cat_id";
display my results:
foreach($Sitesresults as $row)
{
printf("<tr><td>%s</td> <td>%s</td>/tr>",$row['cat_id'],$row['value']);
}
I'm getting the following table:
### cat_id ### value
3000, 100
3000, 200
3000, 300
3000, 400
4000, 100
4000, 300
5000, 100
5000, 200
5000, 300
5000, 400
5000, 500
5000, 600
I wold like to save values of each cat_id as Array and display them as follow:
### cat_id ### value
3000, 100,200,300,400
4000, 100,300
5000, 100,200,300,400,500,600