Hamlets Posted December 28, 2006 Report Share Posted December 28, 2006 (edited) CREATE TABLE `zxc` (`msg` TEXT NOT NULL ,`zxctime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ) Tātad tas zxc izskatās piem šādi : 2006-12-28 11:14:32. Vajadzētu dzēst datus, kuri ir vecāki par 7 dienām. mysql_query("DELETE FROM `zxc` WHERE `zxctime` < '$kaukas'"); Kas šādā gadījumā būtu jāraksta mainīgajā $kautkas, ar date() jāveido vai kā? Edited December 28, 2006 by Hamlets Link to comment Share on other sites More sharing options...
black Posted December 28, 2006 Report Share Posted December 28, 2006 (edited) Varbūt tā? (Pieņemot, ka timestamp vispirms nevajag nokonvertēt uz DATE) mysql_query("DELETE FROM `zxc` WHERE `zxctime` < DATE_SUB(CURDATE(),INTERVAL 7 DAY)"); Edited December 28, 2006 by black Link to comment Share on other sites More sharing options...
Hamlets Posted December 28, 2006 Author Report Share Posted December 28, 2006 Paldies, pārbaudīju un strādā. Link to comment Share on other sites More sharing options...
Recommended Posts