I would like to select the last 4 rows of my table and then put them into a JSON array with a number attached to each piece of data so I can access them later, I would think a loop but don't know how to do it with the counter being the number
The part that gets the last four rows
SELECT title FROM questions ORDER BY id DESC LIMIT 4
And the array be like 1: data one, 2: data two...