SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Apr 2001
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I said that I am a newbie to PHP. I have read a few different books on PHP & MYSQL, and have not come accross the info that I need. I have a website that has images for every item listed, (over 800 items in the Database.) I have set up a page to fetch items from the DB and display them on a page.
    The problem I have is that each item is displayed in a row, i can get it to load up and down, or accross.
    What I would like to do is get it to display in a Table. You know, 5 items per row and 4 rows per page.
    This is probably a simple fix, but I have not a clue how to do it.
    If anyone can help, please let me know!

    The page that I generate is:
    www.ladybugboutique.com/Jokes/Ladybug.php3

    If anyone can help, and would like to see my script, please contact me.

    Thank You in advance,
    Bill
    bill@ladybugboutique.com

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Try something like this:
    PHP Code:
    <table> 
    <tr> 

    <?php 
    $x
    =0

    while(
    $row=mysql_fetch_array($sql_result)) 

        echo 
    "<td>$row['description']</td><td>$row['image']</td>"

        
    $x++; 

        if (
    $x == 4
        { 
            echo 
    "</tr><tr>"
            
    $x=0
        } 
    }
    ?> 

    </tr> 
    </table>
    Sorry, I don't know how to start a new page. I guess you could stop reading $row after you display 5 rows, then display a link to another page with the action script for the link continuing where you left off. That would require passing a value in a query string, a hidden form field, a cookie, or a session variable to indicate the line in your database where you stopped.

    How come you can sell Kenneth Cole shirts for $6.99? And, I think your images are great. Nice job!
    Last edited by 7stud; Apr 14, 2001 at 23:08.

  3. #3
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    To start new pages and print links to each page see this person's script here (beware it is fairly complex):

    http://www.sitepointforums.com/showt...threadid=21012


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
  •