1
Assuming I have a database with X elements! At the time of the query I will use a count
to see how many lines I have! I would like to divide this result and divide by any number, in which case I will use the value of 3,taking into account that I had a return of 9 lines, the result will be 3!
So at the time of echo
I’d like to insert one for div
in "turn" of each 3 results. I would like the result to look like the following!
<div class="inserida_pela_php">
<div class="div_qualquer"> 1 </div>
<div class="div_qualquer"> 2 </div>
<div class="div_qualquer"> 3 </div>
</div>
<div class="inserida_pela_php">
<div class="div_qualquer"> 4 </div>
<div class="div_qualquer"> 5 </div>
<div class="div_qualquer"> 6 </div>
</div>
<div class="inserida_pela_php">
<div class="div_qualquer"> 7 </div>
<div class="div_qualquer"> 8 </div>
<div class="div_qualquer"> 9 </div>
</div>
Great! I’ll even study more with this piece of yours!
– ivan veloso
Unfortunately I don’t remember what it’s called, but when you use % it splits and returns the rest, like 9%8=1
– user1811893
Only complementing:
%
Means Module , is one of the arithmetic operators! it returns the rest of a division,$a % $b
the result will be the rest of$a
divided by$b
.– Cassiano José
I need to add a query to the database!! And distribute the data between the columns! I used! But instead of distributing the 18 results by the div! It ta repeating everything every time the div "inserted_pela_php"
– ivan veloso
Put somewhere the code you have so far and maybe I can help.
– user1811893