I know how to print data from database on html table but i have one task that i can not understand, and i can not do it.
I have a table in database and when i select those data i want them to display on html table but something like this:
I know how to print data from database on html table but i have
Share
To achieve a table layout like that you just need to condition the placement of the end of your table rows.
What the above does is use the modulus operator (
%, calculates the remainder from division) to print a closing and opening row tag whenever we’re at an evenly numbered result.Also, if you wanted to change your table layout to be 3 or 4 columns wide all you need to do is change the number applied to the modulus: