Jump to content

Help with time for auction


debuitls

Recommended Posts

Hello all,

 

Having a bit of a problem and not sure where to start with.

Maybe someone here could point me in the correct direction.

I have the following code.

 

$result = mysql_query("SELECT proposal.*, count(bid.proposalid) AS bids,SYSDATE(), TIME_FORMAT(TIMEDIFF(tomorrowtime, SYSDATE()), '%H hours, %i minutes') AS timeleft
FROM proposal
LEFT JOIN bid ON proposal.proposalid = bid.proposalid
WHERE proposal.username = '$username' AND proposal.time > NOW()- INTERVAL 1 DAY
GROUP BY proposal.proposalid");

 

This returns a set of results which I echo to the screen

 

If you see there I have a where NOW()- INTERVAL 1 DAY.

 

I want to change this to an interval of 2 days so that results for the last two days are returned

 

However because its a 24 auction im building whereby the auction runs for 24hrs and there is a period of 24hrs where people can accept the bids  I want the timeleft row only to countdown for first 24 hours and then stop and say someting like 'end of auction' .

 

Anyone have an idea how to do this?

 

Any suggestions really appreciated!

 

Thanks

Link to comment
Share on other sites

Your query seems it will not get those over 1 day, therefore can not display anything for them.

 

If is a larger database, maybe limit timeframe to a week or however long the actual auction is live for, or if you have a status field for active/ended etc..

 

Try the query getting all data, then checking time offset in the while statement printing the different results as you require?

Link to comment
Share on other sites

Thank for getting back to me ozestretch.

 

I'm new to php, so im not sure I understand your suggestion with regards the time offset?

 

Ill rephrase my question just to ensure I'm being clear.

 

Ill set the query to

 

NOW()- INTERVAL 2 DAY

 

So obviously all the relevant proposals made within the last 48 hours will be returned.

 

I want all the proposals from the last 2 days to be returned because the auction runs for 24 hours, and then the user has a chance to accept these offers for a further 24 hours. After this 48 period the proposal should drop off the screen.

 

Now where the proposal is printed there is contdown row which countsdown from 24hrs.  What im trying to do is after the 24hrs of the auction i want it to print 'end of auction' as the 24 hrs have expired but I still want the proposal on screen because the user can still accept the bid for another 24hrs.

 

Really appreciate if anyone could get suggest anything on this.

 

Thanks

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.