shortysbest Posted December 30, 2010 Share Posted December 30, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/223011-should-i-use-php-sessions-to-store-certain-information/ Share on other sites More sharing options...
Maq Posted December 30, 2010 Share Posted December 30, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/223011-should-i-use-php-sessions-to-store-certain-information/#findComment-1153027 Share on other sites More sharing options...
fortnox007 Posted December 30, 2010 Share Posted December 30, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/223011-should-i-use-php-sessions-to-store-certain-information/#findComment-1153034 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.