1 Replies - 995 Views - Last Post: 22 April 2009 - 06:39 AM Rate Topic: -----

#1 we_undertaker   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 06-May 08

how to display the product in auction

Posted 22 April 2009 - 06:23 AM

$query = "insert into item(item_title, item_price, item_category, item_closedate, iterm_pic, user_id) values('".$_POST['item_title']."', '".$_POST['item_price']."', '".$_POST['item_category']."', '".$_POST['close_year']."-".$_POST['close_month']."-".$_POST['close_day']."'	,'".$filename."',  ".$_REQUEST['userid'].")"; 

this is the query that i will insert into database, but i got stuck that.
i dont know how to display the item in the auction pages, that products are be4 close date. if any product after closedate then it will not display in the auction page.. its about the date in sql. but this problem first time i face...i tried to search but could not help...
plz help me.

Is This A Good Question/Topic? 0
  • +

Replies To: how to display the product in auction

#2 pemcconnell   User is offline

  • D.I.C Regular
  • member icon

Reputation: 54
  • View blog
  • Posts: 472
  • Joined: 05-August 08

Re: how to display the product in auction

Posted 22 April 2009 - 06:39 AM


you can use mathmatical operators on the date in a where clause, for example:

SELECT * FROM table WHERE closedate < NOW();


This should be reviewed if you are to make this a production level application, as the above query won't cache as you are causing the query to change every time it is executed. An ideal solution would be to generate the date in php and pass that to the SQL query so it can just cache the results on a daily basis (meaning you have a faster and more efficient application). But don't worry about that stuff yet if you are only starting MySQL. It will work either way.

This post has been edited by pemcconnell: 22 April 2009 - 06:39 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1