swapnil7779 Posted May 2, 2013 Share Posted May 2, 2013 (edited) Hi, I am merging the two arrays at particular date. If both array have same date then it will merge the array & plot that array on the graph. But problem is that it is merging the array & appending the bar at the start of the bar only, but not at the specific date where the both date are equal. for e.g. array1 = (18/03/2013 => 10, 20-03-2013 => 6, 21-03-2013 => 10); array2 = (20-03-2013 => 5); . so it should append the bar at 20-03-2013 but actually it is appending the bar at the start only i.e. 18-03-2013. plz help me thanks in advance hear is my code $count = __Select("tbl_call_master","COUNT(DATE(date_time)) AS call_count , DATE(date_time)AS date ","WHERE DATE(date_time) BETWEEN '$from_date' AND '$to_date' GROUP BY DATE(date_time) "); $get_first_array=array(); $test= array(); while($row = mysql_fetch_array($count)) { $record1[]= array( $row['date'], $row['call_count'] ); } $wip= __Select("tbl_call_master","COUNT(DATE(date_time)) AS call_count , DATE(date_time) AS date ","WHERE status= 'WIP' AND DATE(date_time) BETWEEN '$from_date' AND '$to_date' GROUP BY DATE(date_time) "); while($row= mysql_fetch_array($wip)) { $wiprecord[]= array( $row['date'], $row['call_count'] ); } $chk=0; foreach ( $record1 as $key=> $value ) { if($chk==1){ $get_first_array[$key] = $record1[$key]; } foreach ( $wiprecord as $key=> $value1) { end($wiprecord); $last=key($wiprecord); if($key==$last ){ $chk=1; } if($value[0] == $value1[0] ) { array_push($record1[$key], $wiprecord[$key][1]); $get_first_array[$key] = $record1[$key]; print_r( $get_first_array[$key]); } } } Edited May 2, 2013 by KevinM1 code tags Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted May 2, 2013 Share Posted May 2, 2013 In the future, please post questions about your PHP code in our PHP Coding Help section, and place any code you want us to see within tags (you can either do that manually, or by clicking the <> button on the editor). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.