Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-07-03
3
Medium Priority
?
746 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

670 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