php - Multidimensional array issue when doing a SOAP request -


i pulling magento instance using soap v2 api. magento returning results of requests multidimensional arrays, encoding in json parse html. when run format:

array(     array(         array()     ) ) 

i getting notice: array string conversion error.

here code:

//make sure query set if (!empty($_get['q'])) {      $getquery = $_get['q'];      //requests     switch ($getquery) {         case 'allorders':             $result = json_decode(json_encode($client->salesorderlist($session)), true);             break;         case 'inventory':             $result = json_decode(json_encode($client->cataloginventorystockitemlist($session, array(695, 694, 693, 692))), true);             break;         case 'products':             $result = json_decode(json_encode($client->catalogproductlist($session)), true);             break;     }      //if (!empty($result)) {     ?>      <table>         <thead>             <tr>                 <th><?php echo implode('</th><th>', array_keys(current($result))); ?></th>             </tr>         </thead>         <tbody>             <?php foreach ($result $row): $row; ?>                 <tr>                     <td><?php echo implode('</td><td>', $row); ?></td>                 </tr>             <?php endforeach; ?>         </tbody>     </table>      <?php     //} } else {     echo "no results found"; }  // close session $client->endsession($session); 

the error happening on second implode in loop.

update 14:45pm cst

this actual output looks like

array (     [0] => array         (             [product_id] => 481             [sku] => 012             [name] => twill cap             [set] => 9             [type] => simple             [category_ids] => array                 (                     [0] => 3                     [1] => 4                     [2] => 5                     [3] => 11                 )              [website_ids] => array                 (                     [0] => 2                 )          ) ) 

as long data not add level o data:

<?php foreach($bar $row): ?>                <tr>                     <td><?php echo implode('</td><td>', array_map(function($e) {                 return is_array($e) ? implode(', ', $e) : $e;             },  $row)); ?></td>                 </tr> <?php endforeach; ?> 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -