Php and bootstrap | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Php and bootstrap

I have a function that gets products from the database.my theme create with bootstrap 4. col-3 for my sidebar and col-9 for my content. How do I call a function to have 3 products in each row? When i use <div class="col_9"> <div class="col_4"> Myproduct(); </div> <div class="col_4"> Myproduct(); </div> <div class="col_4"> Myproduct(); </div> </div> My function is repeat in each col

8th Jul 2020, 6:13 PM
foozhan
foozhan - avatar
1 Answer
+ 13
Use "for" or "foreach": for ($i = 0; $i < $numberOfProducts; $i++) { echo '<div class="col_4">' . Myproduct(). '</div>' ; }
9th Jul 2020, 7:23 AM
Igor Makarsky
Igor Makarsky - avatar