emiliano Posted October 8, 2003 Share Posted October 8, 2003 Hi, i'm trying to improve Cieto Featured Products.. I'm changing the way of using the contribution... i need in a datetime db field to update the value to "now () + xx days" I read the mysql manual.. i tried passing everything tu unixtime, add 86400 seconds (one day in seconds), and then i tried to format the date again.. i tried several things but nothing worked... I also tried to update the value with php's fucntion date() but nothings worked... someone could help me? cheers Emiliano patagonia, argentina Link to comment Share on other sites More sharing options...
arbuzas Posted October 8, 2003 Share Posted October 8, 2003 Try to_days() function. It should help you. select * from table where to_days(date_field) <= (to_days(now()) + xx) Best regards from Vilnius Tom Arbuzas Link to comment Share on other sites More sharing options...
Guest Posted October 8, 2003 Share Posted October 8, 2003 update table set date_time = date_time + INTERVAL XX day where whatever Or am I missing what you want? Reference here. Hth, Matt Link to comment Share on other sites More sharing options...
emiliano Posted October 9, 2003 Author Share Posted October 9, 2003 i read the reference, but as my english it's not as good as i want maybe i missed something.. sorry.. event i read and read and read again and again, i can't found what i'm looking for.. the idea is to update a record.. so return tep_db_query("update " . TABLE_PRODUCTS . " set products_featured = '1', products_last_modified = now(), products_featured_until = "now() + xx days" where products_id = '" . (int)$products_id . "'"); i can't found what i have to put where "now() + xx days" is to add xx days to a record, that sometimes has NULL as inital value... the to_days function it seems to search, but not to update tables... if someone could help me... please!! it's for the community, don't forget i'm planning to release cieto featured products ms2! cheers emiliano patagonia, argentina Link to comment Share on other sites More sharing options...
Guest Posted October 22, 2003 Share Posted October 22, 2003 Does $num_of_days_to_feature = 30; ? ? ?return tep_db_query("update " . TABLE_PRODUCTS . " set products_featured = '1', products_last_modified = now(), products_featured_until = now() + INTERVAL " . (int)$num_of_days_to_feature . " day where products_id = '" . (int)$products_id . "'"); work? Obviously, $num_of_days_to_feature can be replaced with another variable in practice, but doing it this way allows us to focus on the SQL syntax for now. You can always tweak it later. Cheers, Matt Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.