Solved

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

Posted on 2006-07-03
3
602 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 500 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now