If I have an event which consist of 100 tasks, how to rewrite the below code,so i can show all the dealine of each task into <table>? Thanks!
<?php
require("connect.php");
$deadline = mysql_query("SELECT * FROM events WHERE taskid='1001'");
$row= mysql_fetch_assoc($deadline);
$deadline2 = ($row['deadline']);
//dealine for this task(1001) is 2011-3-10-5-45//
$deadline3 = explode("-", $deadline2);
// countdown function
// parameters: (year, month, day, hour, minute)
countdown($deadline3[0],$deadline3[1],$deadline3[2],$deadline3[3],$deadline3[4]);
function countdown($year, $month, $day, $hour, $minute)
{
// make a unix timestamp for the given date
$the_countdown_date = mktime($hour, $minute, 0, $month, $day, $year, -1);
// get current unix timestamp
$today = time();
$difference = $the_countdown_date - $today;
if ($difference < 0) $difference = 0;
$days_left = floor($difference/60/60/24);
$hours_left = floor(($difference - $days_left*60*60*24)/60/60);
$minutes_left = floor(($difference - $days_left*60*60*24 - $hours_left*60*60)/60);
// OUTPUT
echo "Today's date ".date("F j, Y, g:i a")."<br/>";
echo "Countdown date ".date("F j, Y, g:i a",$the_countdown_date)."<br/>";
echo "Countdown ".$days_left." days ".$hours_left." hours ".$minutes_left." minutes left";
}
?>
//--------------------------
// author: Louai Munajim
// website: www.elouai.com
//
// Note:
// Unix timestamp limitations
// Date range is from
// the year 1970 to 2038
//-------------------------