I need to form an multidimensional array as below format however i could not figure out the algorithm
array(
[0]=>array(
"id"=>"1","data"=>array([0]=>array("kid"=>"434","k"=>"Ali","m"=>"msj1"), [1]=>array("kid"=>"344","k"=>"Dali","m"=>"msj3")),
[1]=>array(
"id"=>"2","data"=>array([0]=>array("kid"=>"347","k"=>"Cenk","m"=>"msj2"), [1]=>array("kid"=>"345","k"=>"Tan","m"=>"msj4")))
the data comes from mysql query like below:
SELECT kid, k, m, id FROM table1 WHERE rid=1 ORDER BY (id)
sample data:
id kid k m
1 434 Ali msj1
2 347 Cenk msj2
1 344 Dali msj3
2 345 Tan msj4
php loop is as below:
do {
//whatever i tried here failed :(
} while ($t = mysql_fetch_assoc($r_tav));
i hope that i will understand multidimensional arrays better with this sample