PHP to Cycle Through Messages in Kiosk

I need to create a simple script to cycle through records in a table, each one showing on a single screen.  Basically, I have already written a simple system where messages are entered into a table.  I want to be able to cycle through them, 1 minute per message, using PHP and MySQL and no Javascript or AJAX, if possible.  

I was considering adding a column to the table for a bit that can be checked if the message was shown, once all bits are checked, it unchecks them and goes through again?

Any pointers for newbie are appreciated.
hydraziAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SStoryCommented:
<meta http-equiv="refresh" content="60"> <!-- Refresh every 1 minute -->

Open in new window


Put this at the top of the page.

In the PHP code when the page is loaded have it hit the DB. Choose a random record or something. You could call a MySQL Stored Proc that does this. You could have it with a bit that marks it.
0
hydraziAuthor Commented:
Hey, yeah I already did the refresh meta tag!  It currently switches between 2 screens, back and forth.  Now they wanna get nuts and have many messages.  Next they will want pictures and video, I'm sure.

Choosing a random record is interesting but I think I need to put them in order.
0
shishir_sriCommented:
Suggestion 1:
Why don't you simply output multiple records on the page, and use a client-side script to cycle through them?

I think this would definitely be better than refreshing a page every minute.

Suggestion 2:
You can use $_SESSION to store the id of the last displayed record. If the session variable exists, show the record which will come after the id stored in session. If the session variable does not exist, you know that the user is coming for the first time, and show the first record.
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

hydraziAuthor Commented:
I really like solution 1, it makes sense!  How would I do that?
0
Ray PaseurCommented:
using PHP and MySQL and no Javascript or AJAX, if possible.
Executive summary: It's probably not possible.  But the JS is very standard jQuery.

Solution 1 requires a client-side implementation.  The design pattern that implements this is available in this article, along with an explanation of how to do it.
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/A_11357-Upgrading-the-Marquee-Tag-with-jQuery.html
0
hydraziAuthor Commented:
I will look at that.  I just keep thinking there has to be a way to load the messages into an array, display message, sleep for 60 seconds, wipe message, display message... etc.
0
Ray PaseurCommented:
Sure there is.  When you read the article you will see exactly how to do it!
0
hydraziAuthor Commented:
Ok, I am going to attempt to learn this as it seems chewable for me!
0
SStoryCommented:
It is definitely possible with a page refresh, that hits the DB and requires with the next ID or a random ID.  You could have the page hit the DB each time and show a random message, or if not to many messages, load all of them into a cache.

Cache example here:
http://davidwalsh.name/php-cache-function

Then each time the page is refreshed, pick a random number and display from that cache.
I am doing a similar thing for a home page message, but it is in the php file and not a db and I just pick a random number and show them, but I have less than 10 messages at present.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hydraziAuthor Commented:
This is just what I needed but I also learned a lot about JQuery that I was unwilling to try and learn before!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.