Jump to content

Recommended Posts

If I am making a "Load more comments" button where it loads, lets say 5 more comments each time you click on it, would it be best to use php sessions to store the id of the last comment loaded? And use that to load the next 5?, continually changing the value of the session to the new id? Or is there a better way of doing this? I had been using hidden textfields to do this.

If I am making a "Load more comments" button where it loads, lets say 5 more comments each time you click on it, would it be best to use php sessions to store the id of the last comment loaded? And use that to load the next 5?, continually changing the value of the session to the new id? Or is there a better way of doing this? I had been using hidden textfields to do this.

 

Why don't you just just pass the id via HTTP and add 5 each time?

maybe somthing like this?

 

change the select query (i assume you're using that)

<?php session_start();
//database connectors here

$_SESSION['number'] = 6; //default
if (isset($_SESSION['number'])){ //if set
    $_SESSION['number']=$_SESSION['number']+5;
}
$query = "SELECT * FROM comments_table WHERE category= 14 LIMIT 1,'$_SESSION['number']'"; //showing number 1-5

//output stuff
?>

 

p.s. i haven't tested it put it could very well work ::)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.