OK, I am assuming you are going to compare the date in the table with the current date when I give you this structure... If my assumption is incorrect, then let me know...
counter
- id int(11) No Null auto_increment
- user_id varchar(11) No Null
- start INT(12) No NULL
- text mediumtext No Null
- base int(10) No Null 0
- border int(10) No Null 0
- textcolor int(10) No Null
You only need the one time entered into the table... That being the one you want to make the comparison with. (The user's birthday for example...)
Now, when you get the user's date... Anniversary for example, and it is 2004-08-27 (That's a good day to be married on by the way 😉)
Then take that date, and convert it to a UNIX Timestamp before you store it...
$start = strtotime("2004-08-27");
// Then use that variable to store it into the start field. (It should be a 10 digit number being stored)
Now in the script from the other thread I referred you to...
// Put that function code I gave you earlier in a separate file called functions.inc.php (in the same directory as this file)
include('./functions.inc.php');
$endtime = time(); // This is our comparison date and time in UNIX Timestamp format.
$qry = mysql_query("SELECT * FROM counter WHERE id = 'valuofid'");
WHILE($row = mysql_fetch_array($qry)){
// Pull out your variables and manipulate them.
$starttime = $row['start'];
// OK, we're going to find the difference between the time stored in the DB (start field) and the date and time defined by the $endtime variable above. All of the work is done inside of the function above.
calcdiff($starttime, $endtime);
// Now we will echo them to make sure it worked.
echo "There are ";
echo $years." year(s), ";
echo $weeks." week(s), ";
echo $days." day(s), ";
echo $hours." hour(s), ";
echo $minutes." minute(s) ";
echo "and ".$seconds." second(s) ";
echo "between <B>".date("l, F jS Y h:i:s A", $starttime)."</B> and <B>".date("l, F jS Y h:i:s A", $endtime)."</B><BR />";
}