JavaScript want to display data using indexing..?

i am working on codeigniter. I want to display data from backend to the view files. here is my code

$result = $obj->get_details();

if ($result[0])
     {
           for ($i=0; $i<count($result); $i++) {

               echo $result [$i]['name'];
           }
     }

while i am doing so i am getting error "Cannot use object of type stdClass as array". I want to display the data using indexing. for example i just want to display the name on the 5th index of an array. Any help would be awesome... THANKS!

Answer:1

Try like

for ($i=0; $i<count($result); $i++) {

    echo $result[$i]->name;
}

Because $result[$i] is an object that will contains the name value

Answer:2

I have (interactive - like python shell) C++ console application and went playing with Emscripten (to transcompile from C++ to JS). All is well, but I'd like the JS's focus-stealing prompt to be ...

I have (interactive - like python shell) C++ console application and went playing with Emscripten (to transcompile from C++ to JS). All is well, but I'd like the JS's focus-stealing prompt to be ...

I'm breaking my head for few days trying to solve this and can't seems to find answer. I'm trying to build a proof of concept for video player using HTML5 that works on Android and IOS, the trick is ...

I'm breaking my head for few days trying to solve this and can't seems to find answer. I'm trying to build a proof of concept for video player using HTML5 that works on Android and IOS, the trick is ...

  1. best way display snakeskin
  2. desmume best display method

I have an array that can look like this: ["whatWP", "isVBZ", "theDT", "temperatureNN", "inIN", "bostonNN"] I want to access the element containing IN, if it exists and the next elements(s) until I ...

I have an array that can look like this: ["whatWP", "isVBZ", "theDT", "temperatureNN", "inIN", "bostonNN"] I want to access the element containing IN, if it exists and the next elements(s) until I ...

  1. access elements array python
  2. access elements array javascript
  3. access elements array java
  4. access elements array bash
  5. access elements array swift
  6. access array elements using pointers
  7. access array elements using indexes
  8. access array elements in php
  9. access array elements using pointers in c
  10. access array elements matlab
  11. access array elements
  12. access array elements in perl
  13. access array elements in c
  14. access array elements scala
  15. access array elements in shell script
  16. access array elements in mongodb
  17. access array elements numpy
  18. access array elements js
  19. access array elements in angular
  20. access array elements using indexes in java

.sr-only the CSS class of the Bootstrap library is used to make things disappear on computer screens only. Is there any opposite class for it to make things disappear on mobiles only? I know there ...

.sr-only the CSS class of the Bootstrap library is used to make things disappear on computer screens only. Is there any opposite class for it to make things disappear on mobiles only? I know there ...