CodeIgniter Forums

Full Version: Not all items passed to view are accessable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
Below is a var_dump of the $data variable before it's passed to a view using load->view("viewname", $data)

Once in the view, I can see all of the variables ($cur_user_name, $asset, etc) EXCEPT $parent_loc is empty.

I did omit some strings (with 'xxx') so if it says String(n) and the number of characters != n, that's why. It's correct in the original.

NOTE: Due to size limitation of this post, I removed one array after "parent_loc" array.


Code:
array(5) {
  ["cur_user_name"]=>
  string(7) "kreeves"
  ["asset"]=>
  array(3) {
    ["ASSET"]=>
    object(stdClass)#15 (9) {
      ["ASSET_ID"]=>
      string(1) "1"
      ["LOC_ID"]=>
      string(2) "33"
      ["MODIFIED_BY"]=>
      string(1) "1"
      ["MODIFIED_DATE"]=>
      string(23) "06-OCT-10 10.58.18.1 AM"
      ["SERIAL_NUM"]=>
      string(8) "A serial"
      ["MODEL_ID"]=>
      string(1) "1"
      ["PURCHASE_DATE"]=>
      NULL
      ["ASSET_TAG"]=>
      string(5) "12345"
      ["LOGIN_ID"]=>
      string(7) "kreeves"
    }
    ["MODEL"]=>
    array(1) {
      [0]=>
      object(stdClass)#17 (9) {
        ["MODEL_ID"]=>
        string(1) "1"
        ["MODEL_NAME"]=>
        string(10) "Test Model"
        ["MANUFACTURER"]=>
        string(12) "Test Manufac"
        ["MODEL_NUMBER"]=>
        string(2) "10"
        ["CATEGORY_ID"]=>
        string(1) "2"
        ["MODEL_ATTRIB_ID"]=>
        NULL
        ["ATTRIB_NAME"]=>
        NULL
        ["VALUE"]=>
        NULL
        ["MODEL_EXTENDED_ID"]=>
        NULL
      }
    }
    ["LOAN"]=>
    array(9) {
      [0]=>
      object(stdClass)#19 (7) {
        ["LOAN_ID"]=>
        string(2) "43"
        ["USER_ID"]=>
        string(1) "1"
        ["START_TIME"]=>
        string(21) "11-MAY-10 03.14.53 PM"
        ["FINISH_TIME"]=>
        string(21) "24-MAY-10 02.32.12 PM"
        ["LOAN_TYPE"]=>
        string(1) "1"
        ["FIRST_NAME"]=>
        NULL
        ["LAST_NAME"]=>
        NULL
      }
      [1]=>
      object(stdClass)#20 (7) {
        ["LOAN_ID"]=>
        string(2) "42"
        ["USER_ID"]=>
        string(1) "1"
        ["START_TIME"]=>
        string(21) "11-MAY-10 03.14.52 PM"
        ["FINISH_TIME"]=>
        string(21) "11-MAY-10 03.14.53 PM"
        ["LOAN_TYPE"]=>
        string(1) "1"
        ["FIRST_NAME"]=>
        NULL
        ["LAST_NAME"]=>
        NULL
      }
      [2]=>
      object(stdClass)#21 (7) {
        ["LOAN_ID"]=>
        string(2) "41"
        ["USER_ID"]=>
        string(1) "1"
        ["START_TIME"]=>
        string(21) "11-MAY-10 03.11.16 PM"
        ["FINISH_TIME"]=>
        string(21) "11-MAY-10 03.14.52 PM"
        ["LOAN_TYPE"]=>
        string(1) "1"
        ["FIRST_NAME"]=>
        NULL
        ["LAST_NAME"]=>
        NULL
      }
      [3]=>
      object(stdClass)#22 (7) {
        ["LOAN_ID"]=>
        string(2) "40"
        ["USER_ID"]=>
        string(1) "1"
        ["START_TIME"]=>
        string(21) "11-MAY-10 03.10.58 PM"
        ["FINISH_TIME"]=>
        string(21) "11-MAY-10 03.11.16 PM"
        ["LOAN_TYPE"]=>
        string(1) "1"
        ["FIRST_NAME"]=>
        NULL
        ["LAST_NAME"]=>
        NULL
      }
      [4]=>
      object(stdClass)#23 (7) {
        ["LOAN_ID"]=>
        string(1) "1"
        ["USER_ID"]=>
        string(1) "1"
        ["START_TIME"]=>
        string(21) "20-APR-10 12.00.00 AM"
        ["FINISH_TIME"]=>
        string(21) "04-MAY-10 12.00.00 AM"
        ["LOAN_TYPE"]=>
        NULL
        ["FIRST_NAME"]=>
        NULL
        ["LAST_NAME"]=>
        NULL
      }
      [5]=>
      object(stdClass)#24 (7) {
        ["LOAN_ID"]=>
        string(2) "58"
        ["USER_ID"]=>
        string(3) "443"
        ["START_TIME"]=>
        string(21) "29-JUL-10 04.32.46 PM"
        ["FINISH_TIME"]=>
        NULL
        ["LOAN_TYPE"]=>
        string(1) "1"
        ["FIRST_NAME"]=>
        NULL
        ["LAST_NAME"]=>
        NULL
      }
      [6]=>
      object(stdClass)#25 (7) {
        ["LOAN_ID"]=>
        string(2) "57"
        ["USER_ID"]=>
        string(3) "443"
        ["START_TIME"]=>
        string(21) "29-JUL-10 04.30.16 PM"
        ["FINISH_TIME"]=>
        string(21) "29-JUL-10 04.32.32 PM"
        ["LOAN_TYPE"]=>
        string(1) "1"
        ["FIRST_NAME"]=>
        NULL
        ["LAST_NAME"]=>
        NULL
      }
      [7]=>
      object(stdClass)#26 (7) {
        ["LOAN_ID"]=>
        string(2) "56"
        ["USER_ID"]=>
        string(3) "443"
        ["START_TIME"]=>
        string(21) "29-JUL-10 10.48.08 AM"
        ["FINISH_TIME"]=>
        string(21) "29-JUL-10 03.06.21 PM"
        ["LOAN_TYPE"]=>
        string(1) "2"
        ["FIRST_NAME"]=>
        NULL
        ["LAST_NAME"]=>
        NULL
      }
      [8]=>
      object(stdClass)#27 (7) {
        ["LOAN_ID"]=>
        string(2) "55"
        ["USER_ID"]=>
        string(3) "443"
        ["START_TIME"]=>
        string(21) "29-JUL-10 09.29.44 AM"
        ["FINISH_TIME"]=>
        string(21) "29-JUL-10 09.43.08 AM"
        ["LOAN_TYPE"]=>
        string(1) "1"
        ["FIRST_NAME"]=>
        NULL
        ["LAST_NAME"]=>
        NULL
      }
    }
  }
  ["buil_list"]=>
  array(2) {
    [27]=>
    string(6) "xxx"
    [15]=>
    string(17) "xxx"
  }
  ["parent_loc"]=>
  array(1) {
    [0]=>
    object(stdClass)#18 (2) {
      ["LOC_ID"]=>
      string(2) "15"
      ["NAME"]=>
      string(17) "Nxxx"
    }
  }
}

If I didn't provide enough information, let me know. I cannot figure out what I am missing on this.

Thanks for any assistance!

El Forum

[eluser]iKode[/eluser]
How are you trying to access the data? If you are trying to use $parent_loc['LOC_ID'] That wont work because the contents of parent_loc is an object.


["parent_loc"]=>
array(1) {
[0]=>
object(stdClass)#18 (2) {
["LOC_ID"]=>
string(2) "15"
["NAME"]=>
string(17) "Nxxx"
}

Try $parent_loc->LOC_ID if you are going to store it as a string make sure you cast it

$idLoc = (string)$parent_loc->LOC_ID;

Give that a shot , it SHOULD work if anyone else can add anything please do so. But I'm pretty sure this should work.

** update **

Looking at that again it may be

$idLoc = (string)$parent_loc[0]->LOC_ID;

let us know if any of those 2 work for you.