I'm doing a bidding listing page and I wanted to add a countdown timer to it. So, I have this Javascript countdown function which is modified from http://keith-wood.name/countdownBasics.html. I'm supposed to pass the ending time to variable t. I have no problems passing in a direct value such as 2011:11:11 12:00:00, however I want to pass the datetime value from another MySQL column, which is 'ending_time'.
$(function () {
var t = ( /*pass the ending time values here. */ ).split(/[- :]/);
var d = new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]);
$('.defaultCountdown').countdown({until: d});
});
I wanted to do a bidding listing page showing the items, ending time,etc and as usual, I did an SQL query and pass the results to mysql_fetch_array and display the results using a while loop below. Now, I would like to add an additional Javascript timer column and start the timer by counting down till the ending time from another column. It should be able to continue looping the results using a while loop until the last row. However, I'm unsure how to output it using the Javascript function above and get it working.
while($row = mysql_fetch_array($result)){
/*countdown to this value, DATETIME format*/ echo"<td> $row[ending_time]</td>";
/*timer column goes here, this should 'call' the Javascrpt timer*/ echo"<td><div class=defaultCountdown></div> </td>";
}
Your assistance is greatly appreciated.