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
Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
Mouse event to control image and transparency. 4 34
Google Analytics setup 5 50
Filktering Alphabetically 8 30
Why is initialize not a function? 8 21
Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

860 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