debuitls Posted September 19, 2009 Share Posted September 19, 2009 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 Quote Link to comment Share on other sites More sharing options...
ozestretch Posted September 20, 2009 Share Posted September 20, 2009 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? Quote Link to comment Share on other sites More sharing options...
debuitls Posted September 20, 2009 Author Share Posted September 20, 2009 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.