how we can display records

1-5 for 1 user.
for 2nd user, we can display 2-6
for 3rd user, we can display 3-7
so on...

Are you talking about database records? What is the table(s) structure?

i have the same problem too. i want to display a list of records from database when i clicked a button, it will display the list of records of 1 id. but i dont have any idea to do it. can someone help me? T________T

Check the below example.

In index.php

<script src="//code.jquery.com/jquery-1.10.2.js"></script>

 <?php

$numberOfUser= 6;
$recordLimit = 5;

?>

<select id="userSelect">
<option value="">---Select User---</option>
<?php
for($i=1;$i<=$numberOfUser;$i++){
    echo <<<EOD
        <option value="$i">User-$i</option>
EOD;
}
?>
</select>


<div class="result">
<h3>Please Select A User</h3>
</div>

<script type="text/javascript">
$(function(){
    $("#userSelect").change(function(){
        var userOrder =$(this).val();
        $.post('request.php',{order: userOrder, numberOfUser: '<?php echo $numberOfUser; ?>', limit: '<?php echo $recordLimit; ?>'}, function(data) {
            $(".result").html(data);
        });
    });
});
</script>

In request.php

<?php
$numberOfUser= $_POST['numberOfUser'];
$recordLimit = $_POST['limit'];

$userOrder = $_POST['order'];


if($userOrder>0) {
//your records
$records = array();
for($i=1;$i<=($recordLimit+($numberOfUser-1));$i++) {
    array_push($records,'R-'.$i);
}

//List Limited Records
$result = "<ul>";

for ($j=($userOrder-1);$j<($recordLimit+($userOrder-1));$j++) {
    $result .= "<li>".$records["$j"]."</li>"; 
}

$result .= "</ul>";
}

else {
    $result = "<h3>Please Select A User</h3>";    
}


echo $result;


?>

Thanks all for reply / discussion

I have an offers tables like there are 100 records and user table.

offer table has offer_id, price , offer_type, user_id_fk... etc
user table has user_id, name ...etc

featured offer means with payed amout let say $3.

When user login so all offers i am displaying now.

if i randomly display records then each records will not get equal exposure to dashboard of userlogin

but what i want

Every featured offer should get equal exposure.
If we are displaying 5 feaured offers out of total of 100 feaured offers, then all 100 should get equal exposure. Across all the different featured.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.