DarkPrince2005 Posted September 12, 2007 Share Posted September 12, 2007 Does anybody know of a script where I can calcullate a datediff and make a pop-up apear a week before a certain date Quote Link to comment Share on other sites More sharing options...
jitesh Posted September 12, 2007 Share Posted September 12, 2007 Date Diff <?php $date1 = "2007-12-12"; $date2 = "2007-12-06"; echo (strtotime($date1) - strtotime($date2))/(60*60*24) ." Days"; ?> Previous week <?php $date1 = "2007-12-12"; echo date("Y-m-d",mktime(0,0,0,12,12-7,2007)); ?> Quote Link to comment Share on other sites More sharing options...
DarkPrince2005 Posted November 12, 2007 Author Share Posted November 12, 2007 how can i retrieve a date from a table and set it to $date1's value and the curdate() to date2's value, cause everything I'm trying isn't working <?php ini_set('display_errors','On'); error_reporting(E_ALL); mysql_connect("localhost","root",""); mysql_select_db("database"); $r=mysql_query("select [i]field[/i] from [i]table[/i] where Employee_Firstname like 'KS'"); $date2 ="$r"; $date1 = "curdate()"; echo (strtotime($date1) - strtotime($date2))/(60*60*24) ." Days"; ?> Quote Link to comment Share on other sites More sharing options...
aschk Posted November 12, 2007 Share Posted November 12, 2007 You might want to try using mysql_fetch_assoc or that $r (result) handle. e.g. $r=mysql_query("select [i]field[/i] from [i]table[/i] where Employee_Firstname like 'KS'"); $row = mysql_fetch_assoc($r); $date2 = $r['field']; $date1 = "curdate()"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.