Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Ok, why doesn't this work... (sql query of date)


sf7804

Recommended Posts

I'm trying to add a "date expected" under my "out of stock" that I have just places on my product listing pages, but I get a WEIRD date back.. something isn't right :(

 

Here's the code I made to pull the date..

	$stockDate =  tep_db_query("select products_date_available from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'");

$expectedDate = tep_date_short($stockDate);

 

The date should show up a 01/31/2003, but instead it says 11/30/2036

 

if I leave out the tep_date_short I get Resource id #72 and tep_date_long doesn't return anything :(

Link to comment
Share on other sites

Ok, I just wanted to let everyone know I fixed it, but I still don't "get" why it wasn't working.. can someone explain it so it makes sense?

 

Here's the new code that works:

	$expected_query = tep_db_query("select products_date_available from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'");

$expected_values = tep_db_fetch_array($expected_query);

$expectedDate = $expected_values['products_date_available'];

$dateAvailable = tep_date_short($expectedDate);

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...