stdclass - How to extract these values in PHP and show it in a table format? -
how display above values page wise, sorting , searching options?
stdclass object ( [totalcdrcount] => 11 [cdrs] => array ( [0] => stdclass object ( [calldate] => 2014-10-31t16:02:38+05:30 [src] => 1111 [dst] => 1978 [channel] => sip/1111-0000000f [dstchannel] => sip/1978-00000010 [disposition] => answered [uniqueid] => 1414751558.15 [duration] => 511 [billsec] => 508 [accountcode] => )
[1] => stdclass object ( [calldate] => 2014-10-31t16:02:22+05:30 [src] => 1111 [dst] => 1111 [channel] => sip/1111-0000000e [dstchannel] => [disposition] => answered [uniqueid] => 1414751542.14 [duration] => 13 [billsec] => 13 [accountcode] => ) [2] => stdclass object ( [calldate] => 2014-10-31t15:33:22+05:30 [src] => 1111 [dst] => 1978 [channel] => sip/1111-0000000c [dstchannel] => sip/1978-0000000d [disposition] => answered [uniqueid] => 1414749802.12 [duration] => 1730 [billsec] => 1722 [accountcode] => ) [3] => stdclass object ( [calldate] => 2014-10-31t15:31:18+05:30 [src] => 1978 [dst] => 1111 [channel] => sip/1978-0000000a [dstchannel] => sip/1111-0000000b [disposition] => answered [uniqueid] => 1414749678.10 [duration] => 117 [billsec] => 110 [accountcode] => ) [4] => stdclass object ( [calldate] => 2014-10-31t15:31:04+05:30 [src] => 1111 [dst] => 1978 [channel] => sip/1111-00000009 [dstchannel] => [disposition] => answered [uniqueid] => 1414749664.9 [duration] => 10 [billsec] => 10 [accountcode] => ) [5] => stdclass object ( [calldate] => 2014-10-31t15:30:30+05:30 [src] => 1978 [dst] => 1111 [channel] => sip/1978-00000007 [dstchannel] => sip/1111-00000008 [disposition] => answered [uniqueid] => 1414749630.7 [duration] => 28 [billsec] => 21 [accountcode] => ) [6] => stdclass object ( [calldate] => 2014-10-31t15:30:11+05:30 [src] => 1111 [dst] => 1978 [channel] => sip/1111-00000005 [dstchannel] => sip/1978-00000006 [disposition] => no reply [uniqueid] => 1414749611.5 [duration] => 4 [billsec] => 0 [accountcode] => ) [7] => stdclass object ( [calldate] => 2014-10-31t15:29:24+05:30 [src] => 1111 [dst] => 1978 [channel] => sip/1111-00000004 [dstchannel] => [disposition] => answered [uniqueid] => 1414749564.4 [duration] => 17 [billsec] => 17 [accountcode] => ) [8] => stdclass object ( [calldate] => 2014-10-31t15:28:36+05:30 [src] => 1978 [dst] => 1111 [channel] => sip/1978-00000002 [dstchannel] => sip/1111-00000003 [disposition] => answered [uniqueid] => 1414749516.2 [duration] => 43 [billsec] => 39 [accountcode] => ) [9] => stdclass object ( [calldate] => 2014-10-31t15:19:18+05:30 [src] => 1978 [dst] => *97 [channel] => sip/1978-00000001 [dstchannel] => [disposition] => answered [uniqueid] => 1414748958.1 [duration] => 25 [billsec] => 25 [accountcode] => ) [10] => stdclass object ( [calldate] => 2014-10-31t15:18:42+05:30 [src] => 1978 [dst] => *79 [channel] => sip/1978-00000000 [dstchannel] => [disposition] => answered [uniqueid] => 1414748922.0 [duration] => 4 [billsec] => 4 [accountcode] => ) ) ) how display above values page wise, sorting , searching options?
just loop on them , ouput table...
<?php if ($response->totalcdrcount > 0) { $fields = array(); foreach ($response->cdrs[0] $field => $value) { $fields[] = $field; } } ?> <table> <thead> <tr> <?php foreach ($fields $field): ?> <th><?php echo $field ?></th> <?php endforeach; ?> </tr> </thead> <tbody> <?php foreach ($response->cdrs $cdr): ?> <tr> <?php foreach ($fields $field): ?> <td><?php echo isset($cdr->$field) ? $cdr->$field : ' ' ?></td> <?php endforeach ?> </tr> <?php endforeach; ?> </tbody> </table> php stdclass
No comments:
Post a Comment