Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7528305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:20:32+00:00 2026-05-30T04:20:32+00:00

I have an array of products and I need to display them 5 items

  • 0

I have an array of products and I need to display them 5 items per row. How can I make it, because now if i do

<?php foreach($data as $entries) : ?>
<td><?php echo $entries->name; ?>
<?php endforeach; ?>

it doesn’t work. Should I make a counter?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T04:20:33+00:00Added an answer on May 30, 2026 at 4:20 am

    Something like:

    $data = range(1, 17);
    for($count = 0; $count < count($data);)
    {
        echo "<tr>\n";
        for($i = 0; $count < count($data) && $i < 5; $count++, $i++) {
            echo "\t<td>$data[$count]</td>\n";
        }
        for(; $i < 5; $i++) {
            echo "\t<td>-</td>\n";
        }
        echo "</tr>\n";
    }
    

    Output

    <tr>
        <td>1</td>
        <td>2</td>
        <td>3</td>
        <td>4</td>
        <td>5</td>
    </tr>
    <tr>
        <td>6</td>
        <td>7</td>
        <td>8</td>
        <td>9</td>
        <td>10</td>
    </tr>
    <tr>
        <td>11</td>
        <td>12</td>
        <td>13</td>
        <td>14</td>
        <td>15</td>
    </tr>
    <tr>
        <td>16</td>
        <td>17</td>
        <td>-</td>
        <td>-</td>
        <td>-</td>
    </tr>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array of products IDs and I need to find the IDs
I have an array of objects that can have up to 6 products in
Basically I have a foreach loop bringing in data from an array of products
I have an array whose structure is like $data = array{0=>'abc',1=>xyz,2=>tqs} Now I need
i have this multidimensional array in php and I need be able to access
I have a products array of widgets. Some widgets have the reserved period symbol
how to send array through url in PHP? I have an array of product
I have this really large array being created and displayed, and right now it
I have a catalog with near 90000 products. I need to retrieve all the
i have an array of products. For each product I have to crate an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.