Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

countdown timer based on server clock and php variable from SQL database

Posted on 2006-07-03
3
Medium Priority
?
778 Views
Last Modified: 2012-06-27
I need to create a 'live' countdown timer on my page, which counts down the difference between the server clock, and a unique date and time held on an SQL database.  Different users will have different times in their profiles, so the timer needs to act upon a variable called from the SQL database.  I know a bit of PHP but no javascript, and am wondering if this is the right language to use to solve my problem?  

I am hoping I can copy a simple javascript countdown code from somewhere, and insert php to call the variable (i.e. instead of writing "2006" in the javascript for the clock, I write in a php tag with an echo call to the $variable), but am unsure if the languages will work together in this way.

Any tips on where to look, how to approach this problem would be most appreciated.  
0
Comment
Question by:RowdyBurns
3 Comments
 
LVL 12

Accepted Solution

by:
AmigoJack earned 2000 total points
ID: 17030775
php is processed before it leaves the server.
javascript is processed after it has reached the client.

that said you can do whatever you want. if you do somewhere an echo("hello"); it can be anywhere in the document. it doesnt matter if you previously did echo("<script>"); because php itself doesnt care.

please mind how the technologies work. php = PreHtmlProcessed, this means php is like a constant html-file which lies on a server. the only addition is that you can program something which will make the html-file being different. the OUTCOMING file itself cannot act - its still only a document and not a program. so try it like you described it yourself and then test the produced file on any client (msie, firefox, opera...)
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question