lyax Posted May 26, 2007 Share Posted May 26, 2007 $timestamp= mysql_query("SELECT UNIX_TIMESTAMP(timestamp) FROM utopia WHERE kullaniciadi='$session->username'"); $hedef = mktime(date("H"),date("i")+1,date("s"),date("m"),date("d"),date("Y")); $simdi = time (); $fark = $timestamp - $simdi; $days_left = floor($fark/60/60/24); $hours_left = floor(($fark - $days_left*60*60*24)/60/60); $minutes_left = floor(($fark - $days_left*60*60*24 - $hours_left*60*60)/60); print " $minutes_left dakika!"; if($row['bolge'] !== 'yol' ){ $result = mysql_query("UPDATE utopia SET timestamp=FROM_UNIXTIME($hedef) , bolge='yol' WHERE kullaniciadi='$session->username'") or die(mysql_error()); echo "Centriaya seyahatiniz $minutes_left dakika sürecek."; } else{ } if($fark > 0){ echo " $minutes_left dakika beklemelisin."; } elseif($fark <= 0){ $result = mysql_query("UPDATE utopia SET bolge='centria' WHERE kullaniciadi='$session->username'") or die(mysql_error()); echo " Geçmiş olsun."; } else{ } it can simply be seen what i tried to do but several big FALSES around here i now. adding 3 minutes to current time and saving into mysql.. according to the difference between that time and the current time print x minutes last. so simple to write it:-) aaa, and i have some problem about time formats.. date time and mysql time.. i dont know how to save and how to read it, actually dont know if it is necessary in this page???? pls help.. im so bored for about 5 hours here! Quote Link to comment https://forums.phpfreaks.com/topic/53075-php-mysql-date-formats-going-crazy-pls-help/ 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.