Skip to content
Advertisement

PHP Need nested array values to dump into html table cell

I have a stdClass Object array with nested User arrays as a value that I would like to display in a table cell.

I am struggling and have exhausted a lot of time. I am hoping to get a shove in the right direction if possible.

The image below will show what I am trying to do.

JavaScript

Here is what my Array and Objects look like

JavaScript

Table Looks like this

enter image description here

Advertisement

Answer

You’re going to have to create the markup for the individual users. It would probably make your life easier to create functions for building the outer rows and the individual user details.

JavaScript

Eventually it would be better to come up with a way of separating your templates and code, this is pretty ugly.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement