I am using a PHP while loop in order to get data from a database. Ignoring the data that I'm retrieving from the database and concentrating on the amount of records I have fetched, which is 4.
I want to be able to take the 1st record and insert it into a div called "div1" and take the 2nd record and insert it into a div called "div2", take the 3rd record and insert it into a div called "div3".
When it comes to the 4th record I would like to insert it in to the div called "div1" and so on.
I've managed to get every 3rd result, so skipping the 1st and 2nd record and being able to do it with the 3rd using a snippet from the below code:
if ($i % 3 < 2) {
I'm having trouble adapting that to do what I want it to do.