dipp02 Posted June 3, 2009 Share Posted June 3, 2009 Hello. I am creating a function for a site to show a list of companies with phone, addy, email, website, etc.. with about 10 listings that will show up on the page so some listings will be "off the screen". what the client would like to have the list do so each company will have a turn at the top of the page. is when the page refreshes the company at the bottom of the list will go to the top of the list and so on. or if anyone has any other idea on how to have each company have a turn at the top of the page... i am using framework codeigniter and mysql database for the site. if i wasn't clear please let me know so i can explain better. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted June 3, 2009 Share Posted June 3, 2009 One way is using sessions, like this example: session_start(); if(!isset($_SESSION['list'])){ $_SESSION['list'] = array( "Company 1", "Company 2", "Company 3", "Company 4", "Company 5", "Company 6", "Company 7", "Company 8", "Company 9", "Company 10" ); } $tmp = $_SESSION['list'][count($_SESSION['list']) - 1]; $list = array_pop($_SESSION['list']); array_unshift($_SESSION['list'], $tmp); echo "<pre>", print_r($_SESSION['list']), "</pre>"; Quote Link to comment Share on other sites More sharing options...
dipp02 Posted June 3, 2009 Author Share Posted June 3, 2009 Thank you very much for the reply! this should help me get it going. Thanks! Quote Link to comment Share on other sites More sharing options...
dipp02 Posted October 22, 2009 Author Share Posted October 22, 2009 How can i do this so on every computer the company thats next in line comes up on every computer not just on the computer i am on? using sessions will only happen to that one computer. so if company 1 is up and i refresh the page company 2 comes up. but on a totally different computer company 1 shows up and not company 3 which is next in line. should i just use a simple for loop? any ideas? i was going to make a field in the database under the company table called 'position' and add/minus the position number everything the page refreshes. Any help on this would be great! Thanks in advance! Quote Link to comment 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.