[PHP] newbie needs help with comparing dates
I need to compare dates which opens commenting system. For example: If show starts 2003.05.01 20:00 then I need that only from that date and time the commenting system apears on my site ant would be there all the time from the start of the show. But in my code the commenting system opens only for one hour, take a look: - $year_now = date("Y",$timelt); $month_now = date("m",$timelt); $day_now = date("d",$timelt); $hour_now = date("H",$timelt); $minute_now = date("i",$timelt); $year_show = $row['year']; $month_show = $row['month']; $day_show = $row['day']; $hour_show = $row['hour']; $minute_show = $row['minute']; if ($year_now >= $year_show && $month_now >= $month_show && $day_now >= $day_show && $hour_now >= $hour_show && $minute_now >= $minute_show) { COMMENTING SYSTEM OPENED { else { COMMENTING SYSTEM CLOSED } - What SOLUTION would solve the problem? P.S. Sorry for mistakes, i`m not american. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] showing idle time with time() function
How to show IDLE TIME which format would be 00:00 (minutes:seconds) ? My PHP script sets time ( with function "time()" )to one of the mysql cell of the current user, when new page is requested. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with mysql versions. help
Hello, I wrote the code for deleting the oldest string in the mysql if it reaches over 15 strings, but it works only under 4.x.x series of MySQL and i have 3.x.x. What should I change in the code that it would work under 3.x.x version of MySQL? Here`s the code: $quer = "SELECT COUNT(id) FROM logai"; $rez = mysql_query($quer); $sk = mysql_result($rez,0); if ( $sk > 15 ) { $wad = $sk - 15; $queryz = "DELETE FROM logai WHERE id <> 'a nu nakuj' ORDER BY id LIMIT $wad"; mysql_query($queryz); }*/ Thank You. Sorry for my bad english :-( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Another problem with mysql version coding
Hey all, the next code i wrote is for deleting users who don`t login for 60 days. This script should work under 4.x.x series of MySQL DB, but i have 3.x.x version. What should i change in this code that it should work on 3.x.x version of MySQL. ( time is given as a timestamp ( saved as time() in mysql ) ). The Code: $GLOBALS['data'] = date ("Y-m-d",$timelt); $GLOBALS['laik'] = date("H:i:s",$timelt); $queriz = "SELECT vartotojas, laikas FROM useriai WHERE (CAST(UNIX_TIMESTAMP(NOW()) AS SIGNED) - CAST(UNIX_TIMESTAMP(laikas) AS SIGNED))>5184000 AND admin != '1'"; $rezult = mysql_query($queriz); if (mysql_num_rows($rezult) != 0) { while ($row2 = mysql_fetch_array($rezult)) { $ka = $row2['vartotojas']; $query = "INSERT INTO logai SET kas='SISTEMA', ka='$ka', data='$GLOBALS[data]', laikas='$GLOBALS[laik]'"; echo mysql_error(); mysql_query($query); $delete = "DELETE FROM useriai WHERE (CAST(UNIX_TIMESTAMP(NOW()) AS SIGNED) - CAST(UNIX_TIMESTAMP(laikas) AS SIGNED))>5184000 AND admin != '1'"; $del = mysql_query($delete); } } P.S. It Also add info to mysql db as logo who delete the user ;-) Thanks if someone could help! NeXaS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php