Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Now() + x days?


emiliano

Recommended Posts

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

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

  • 2 weeks later...

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...