So, I’ve been having a play about with arrays all day and I’m struggling to get my head around them.
I have a select which is populated from a db with a value. I’m then running this value as a server connect query to pull a specific record and then taking the data from this record to add to an array. For example value of select is say 10, which pulls out product, id, price etc and then clicking a button adds these as an array.
This seems to be working correctly and I’m getting the output of widget1,10,2.99
Worked through the tutorial at Working with Arrays just to make sure it was working as expected, and I’m getting a button for each item in the array e.g widget1,10,2.99 and widget2,11,3.99
So, my aim is to populate a table with this info. I’ve set up the table to reference array1.items. When add and item to the array it generates a new row. I have set one cell as $value and as expected each row is outputting the expected result of widget1,10,2.99 etc.
So, maybe I’m overthinking this a bit, but what should I be looking for to output each item into a specific cell e.g, cell 1 - product, cell 2 - id, cell 3- price. Do I need to relate this to some sort of index? Or is there anyway of purely taking the product id from the array, and querying this against the db to populate the table with all the required information on each row?
Help is appreciated!
Thanks
Last updated: