Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Order by Random with Pagination

    PHP Code:
    <?php
    $per_page_b 
    24;

    $sql_b "select * from profile  ";
    $rsd_b mysql_query($sql_b);
    $count_b mysql_num_rows($rsd_b);
    $pages_b ceil($count_b/$per_page_b)
    ?>
    <div align="center">
        <div id="container">
            <div class="search-background">
                <label><img src="loader.gif" alt="" /></label>
            </div>
        
            <div id="orta"></div>
        </div>
        <div id="paging_button">
            <ul>
            <?php
            
    //Show page links
            
    for($i_b=1$i_b<=$pages_b$i_b++)
            {
                echo 
    '<li id="'.$i_b.'">'.$i_b.'</li>';
            }
    ?>
            </ul>
        </div>







    PHP Code:
    <?php


    $per_page_bs 
    4;
    $sqlc_bs "show columns from profile  ";
    $rsdc_bs mysql_query($sqlc_bs);
    $cols_bs mysql_num_rows($rsdc_bs);
    $page_bs $_REQUEST['page'];

    $start_bs = ($page_bs-1)*4;
    $sql_bs "select  id,resim0,adi,fiyat,big,adres from profile where big=1 order by rand() limit $start_bs,4";
    $rsd_bs mysql_query($sql_bs);
    ?>
    <?php
    while ($rows_bs mysql_fetch_assoc($rsd_bs))
    {    
    echo
    '<li class="marg_right1">';
        echo
    '<a  href="'$site $rows_bs['adres'].'.html" id="various3"><img src="resimler/'$rows_bs['resim0'] .'" alt=""  width="213" height="320"></a>';
        echo
    '<div style="top: 346px;" class="box1">';
        echo
    '<div class="alan_orta">';
        echo
    '<p class="adi">'.$rows_bs['adi'].'</p>';
        echo
    '<p class="line_height"><span class="color1">Saatlik Ücret:</span><br/>';
        echo
    '<span class="font1 line_height">' .$rows_bs['fiyat']. ' TL </span></p>';
        echo
    '<a  href="'$site $rows_bs['adres'].'.html" id="various3"></a>';
        echo
    '</div>';
        echo
    '</li>';

    }
    ?>



    This is my pagination script.

    I am trying to ramdomize the results so that everyone has a chance of being on the first page, but I don't know how to hold it after the first page, when I click on page 2, it randomizes the results again, and puts some of the ones on the first page on the second.


    What can i do?

  • #2
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    put if else condition. and add increment

    if(i<=10; i++)
    {
    pagination
    }


    computer service
    computer sales
    Last edited by cssofmo; 08-22-2011 at 02:27 PM.

  • #3
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    not working

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Its not that simple, think about your title alone. Random + Pagination cannot be done without a cache. You'll need to fetch all records into a temporary table or view then you can paginate them.

  • #5
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    Its not that simple, think about your title alone. Random + Pagination cannot be done without a cache. You'll need to fetch all records into a temporary table or view then you can paginate them.

    i thing this but i am dummy i dont know how


  •  

    Posting Permissions

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