w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
codeigniter select result array

This is my sample code, I hope it helps.

public function GetNewestPointers() 
{
  $user_last_login= $this->api_model->getUserLastLogin();
  $result = $this->api_model->getNewestPointers($user_last_login);

  if ($result) 
  { 
    $status = "1";
    $msg = "SUCCESS";
  } 
  else
  {
    $status = "0";
    $msg = "ZERO_RESULT";
  }

  // sample code
  foreach ($result as $data) 
  {
    $item_list = $this->api_model->getIdData($data['id']);
    $result[$data['id']]['item_list'] = $item_list;
  }

  $output = array(
    'status' => $status,
    'message' => $msg,
    'result' => $result
  );

  jsonOutput($output);
} 




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.