SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Page Listing

  1. #1
    SitePoint Enthusiast Black Dragon's Avatar
    Join Date
    Apr 2005
    Location
    Swindon, UK
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Page Listing

    Heya!

    Another little query, and im sure some clever person will find a link, how do i get MySQL & php to output "you are viewing page one of 12" and have links?

    EG: Page 1, Page 2 (shows next 8), Page 3 (shows 8 after that)

  2. #2
    SitePoint Evangelist Tecknowjnkie's Avatar
    Join Date
    Nov 2004
    Location
    Mission Viejo
    Posts
    403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Search in here for "Paged Results" or "Results Pager"

  3. #3
    SitePoint Addict
    Join Date
    Dec 2004
    Location
    San Francisco
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Some time back I found one excellent resource which I used for my site www.UnivSearch.com

    I don't remeber that right now, in mean time Check this:

    http://www.phpfreaks.com/tutorials/43/0.php

  4. #4
    SitePoint Enthusiast ada80ro's Avatar
    Join Date
    Apr 2005
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  5. #5
    orange pips! orange pips!
    Join Date
    Oct 2001
    Location
    Its all about location
    Posts
    652
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is an article on this here at sitepoint:
    http://www.sitepoint.com/article/php...g-result-sets/

  6. #6
    SitePoint Enthusiast lavercq's Avatar
    Join Date
    Mar 2005
    Location
    near nice
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank's all, but the links you give use a simple query to a table alone.
    My problem is more complex, the results are issued of two table :
    table 'motsbar' and table 'liaison'...
    In his article (http://www.sitepoint.com/article/php...-result-sets/5)Kevin Yank put a query only on table 'jokes':
    $rs = new MySQLPagedResultSet("select * from jokes where aid=$aid", 5,$cnx);
    But what, if the query was complex, (like in his book) ?
    Here it is:
    $select = 'SELECT DISTINCT ID, JokeText, JokeDate, aid';
    $from = ' FROM Jokes';
    $where = ' WHERE 1=1';
    $aid = $_POST['aid'];
    if ($aid != '') { // An author is selected
    $where .= " AND AID='$aid'";}
    $cid = $_POST['cid'];
    if ($cid != '') { // A category is selected
    $from .= ', JokeLookup';
    $where .= " AND ID=JID AND CID='$cid'";
    }
    $jokedate = $HTTP_POST_VARS['JokeDate'];
    if ($jokedate != '') { // A date is selected
    $from .= ', jokes';
    $where .= " AND JokeDate='$jokedate'";}
    $searchtext = $_POST['searchtext'];
    if ($searchtext != '') { // Some search text was specified
    $where .= " AND JokeText LIKE '%$searchtext%'";
    }?>
    <table border="1">
    <tr><th>Joke Text</th><th>Options</th><th>Date</th></tr>
    <?php
    $jokes = @mysql_query($select . $from . $where);
    How can be managed this result ?
    <?php while ($row = $rs->fetchArray()): ?>
    Must I replace $jokes by $rs ?


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
  •