How to sort same next value in foreach loop using php? -


i new php. want hide same data in foreach loop.

here code:

foreach($recording_record $row ){ echo $row->criteria_title; echo $row->question_title; } 

my current interface:enter image description here

how want interface be:

enter image description here

here print_r data:

array ( [0] => stdclass object ( [record_id] => 6 [qm_id] => 2 [qm_title] => qm lead 2 [record_filename] => abcdefgh.mp3 [userid] => 1002 [unique_id] => 1325554791.71044 [supervisor_id] => 1000 [date_created] => 2013-05-14 05:29:24 [status] => 3 [id] => 6 [callid] => 1325554791.71044 [callerid] => 0383153394 [queuename] => t1-bm_oe [extension] => sip/1003 [ivrtime] => 2013-05-14 11:14:36 [queuetime] => 2012-01-03 09:40:33 [connecttime] => 2013-05-09 09:40:36 [disconnecttime] => 2012-01-03 09:46:34 [callduration] => 358 [holdduration] => 0 [queueduration] => 3 [ansduration] => 3 [ringduration] => 0 [lastevent] => completeagent [transfer] => [wrapups] => ,12 [tenantid] => 1 [supervisor] => 1005 [username] => fara [userpass] => 1234 [lastname] => binti johari [firstname] => nurul farahhin [userlevel] => 2 [usercreated] => 2011-03-26 23:11:56 [lastlogin] => 2012-10-13 20:17:10 [userexten] => [sessionid] => [userstatusid] => 0 [apptype] => webagent [statustimestamp] => 2012-10-13 20:33:21 [lastuserstatusid] => 1 [pqueuetimeout] => 0 [queueroutetype] => 1 [queueroutevalue] => 4 [userdbstatus] => [criteria_id] => 1 [criteria_title] => did not demonstrate inappropriate behavior - 0 tolerance policy [criteria_rate] => 40 [question_id] => 4 [question_title] => question 2 [question_type] => n [question_score_y_yes] => [question_score_y_no] => [question_score_y_answer] => [question_score_y] => [question_score_n_a] => 1 [question_score_n_a_value] => true [question_score_n_b] => 0 [question_score_n_b_value] => false [question_score_n_c] => 0 [question_score_n_c_value] => [question_score_n_d] => 0 [question_score_n_d_value] => [question_score_n_e] => 0 [question_score_n_e_value] => [question_score_n_answer] => [question_score_n] => ) [1] => stdclass object ( [record_id] => 6 [qm_id] => 2 [qm_title] => qm lead 2 [record_filename] => abcdefgh.mp3 [userid] => 1002 [unique_id] => 1325554791.71044 [supervisor_id] => 1000 [date_created] => 2013-05-14 05:29:24 [status] => 3 [id] => 6 [callid] => 1325554791.71044 [callerid] => 0383153394 [queuename] => t1-bm_oe [extension] => sip/1003 [ivrtime] => 2013-05-14 11:14:36 [queuetime] => 2012-01-03 09:40:33 [connecttime] => 2013-05-09 09:40:36 [disconnecttime] => 2012-01-03 09:46:34 [callduration] => 358 [holdduration] => 0 [queueduration] => 3 [ansduration] => 3 [ringduration] => 0 [lastevent] => completeagent [transfer] => [wrapups] => ,12 [tenantid] => 1 [supervisor] => 1005 [username] => fara [userpass] => 1234 [lastname] => binti johari [firstname] => nurul farahhin [userlevel] => 2 [usercreated] => 2011-03-26 23:11:56 [lastlogin] => 2012-10-13 20:17:10 [userexten] => [sessionid] => [userstatusid] => 0 [apptype] => webagent [statustimestamp] => 2012-10-13 20:33:21 [lastuserstatusid] => 1 [pqueuetimeout] => 0 [queueroutetype] => 1 [queueroutevalue] => 4 [userdbstatus] => [criteria_id] => 1 [criteria_title] => did not demonstrate inappropriate behavior - 0 tolerance policy [criteria_rate] => 40 [question_id] => 3 [question_title] => question 1 [question_type] => y [question_score_y_yes] => 1 [question_score_y_no] => 0 [question_score_y_answer] => [question_score_y] => [question_score_n_a] => [question_score_n_a_value] => [question_score_n_b] => [question_score_n_b_value] => [question_score_n_c] => [question_score_n_c_value] => [question_score_n_d] => [question_score_n_d_value] => [question_score_n_e] => [question_score_n_e_value] => [question_score_n_answer] => [question_score_n] => ) 

any idea how it?

$i = 0; $criteria = array(); foreach($recording_record $row ){    $criteria[$i] = $row->criteria_title;   if($i > 0){       if ($criteria[$i] != $criteria[$i-1]){          echo $criteria[$i];        }    } else {         echo $criteria[$i];    }    echo $row->question_title;   $i++; } 

Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -