create number in php page

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 30
Joined: Mon Mar 07, 2011 11:38 pm

Thu Apr 11, 2013 4:18 pm

I have a problem to create the sequence number when page refresh

I have data with sequence number. like 1 to 10.
PHP page refresh for every 10 sec. I need to pull the data and show in the screen one by one.

Let say, php page shows the first record with sequence no = 1
Refresh after 10 sec, pages should show second record with sequence no =2

Randomly, I can select using rand(). But i need sequence one by one.

Pls help me



php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Thu Apr 11, 2013 8:37 pm

Use a session variable to keep the count.

New php-forum User
New php-forum User
Posts: 20
Joined: Tue Mar 06, 2012 11:05 pm

Mon Apr 15, 2013 1:18 am


yes, use a session variable like below:

if(isset($_SESSION[count]) && $_SESSION[count] < some number){
$_SESSION[count] = 1;

Now use this session variable.

Post Reply