SEO Software
Closed Thread
Results 1 to 2 of 2

Thread: PHP loop through database and limit number of entries

  1. #1

    Default PHP loop through database and limit number of entries

    Hi,
    Going to try to explain this as best I can. I have a bunch of stuff in a database and I need to display this info within a table. This isn't a problem at all but, I need it to only display 3 td tags per line and then move on to the row.

    so i need it to do :

    code:

    <table>
    <tr>
    <td>My First Row</td>
    <td>My First Row 2</td>
    <td>My First Row 3</td>
    </tr>

    <tr>
    <td>My Second Row</td>
    <td>My Second Row 2</td>
    <td>My Second Row 3</td>
    </tr>
    </table>



    and continue to do this through every entry in the database table.

    so I have something like this that will display the info:

    code:

    for ($i = 1; $i <= $num; $i++){

    $chairArray = mysql_fetch_array($chairResult);
    $chairName = $chairArray['name'];
    $chairDescription = $chairArray['description'];
    $chairImage = $chairArray['image'];

    echo "<tr>";
    echo "<td>";
    echo "<img src=\"images/catalog/ottomans/thumbs/$chairImage\" width=\"157\" height=\"147\" />";
    echo "<br />";
    echo $chairName;
    echo "</td>";
    echo "</tr>";


    }
    Thanks & regards,
    Lokananth
    Live Chat Software By miOOt


  2. SEO Software

  3. #2

    Default

    It will be better if you will use limit clause of mysql query to generate output you need

Closed Thread

Similar Threads

  1. Pr by Blog Entries
    By MoonDance in forum SEO Forum
    Replies: 17
    Last Post: 12-02-2010, 02:00 AM
  2. Number of connection from perticular IP addfess:
    By vasudha in forum Web Hosting Forums
    Replies: 1
    Last Post: 08-20-2009, 12:45 AM
  3. port number
    By vasudha in forum SEO Forum
    Replies: 4
    Last Post: 08-06-2009, 09:49 AM
  4. PHP loop through database and limit number of entries
    By gilbertsavier in forum PHP Help
    Replies: 0
    Last Post: 07-17-2009, 06:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts