php - Counter inside while loop every X times increase -
I'm not sure how to work this question, but I currently have loop output in Let's say there are 35 rows and I want to increase the counter every five times. Then the output will be something like this. To try to clarify this ... basically I would like to run a counter variable. Starting from 1, but every fifth time through the loop, I would like to increase this count variable from one. & Lt; Li & gt; ; & Lt; / Li & gt; .
$ count = $ rows = 0; While ($ stmt-> fetch ()) {if ($ rows% 5 == 0) $ count ++; $ Rows ++; $ HTML = "& Lt; li Data-id = '$ id' data-name = '$ name' & gt; $ count name & lt; / li & gt;"; }
Comments
Post a Comment