Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

create number in php page

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

create number in php page

Postby maideen » Thu Apr 11, 2013 4:18 pm

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

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

Thanks

Maideen
maideen
New php-forum User
New php-forum User
 
Posts: 27
Joined: Mon Mar 07, 2011 11:38 pm

Re: create number in php page

Postby johnj » Thu Apr 11, 2013 8:37 pm

Use a session variable to keep the count.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: create number in php page

Postby swarups » Mon Apr 15, 2013 1:18 am

Hi,

yes, use a session variable like below:

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

Now use this session variable.
swarups
New php-forum User
New php-forum User
 
Posts: 20
Joined: Tue Mar 06, 2012 11:05 pm


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot], Google Feedfetcher and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.