Forum Moderators: coopster

Message Too Old, No Replies

Reverse Auction Systems

Need tutorial or basic script

         

one_mind

8:28 am on Oct 30, 2005 (gmt 0)

10+ Year Member



Hi,

I am trying to make a reverse auction system for my site and was wondering if anyone knew any good tutorials or easy scripts that can show me how its done.

I dont want a full blown system, just the basic skeleton would be good :)

Thanks

ergophobe

10:13 pm on Oct 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you google for
php reverse auction script

you'll get a bunch of stuff, but I suppose you've already done that and would like help sorting the wheat from the chaff. Sorry, I can't help there.

[edited by: ergophobe at 2:55 am (utc) on Oct. 31, 2005]

one_mind

2:00 am on Oct 31, 2005 (gmt 0)

10+ Year Member



Yeah i did that,

most of the results are commercial scripts. No luck finding a tutorial though.

Guess i'll just figure out the date stuff for myself. Shoudn't be that hard.

ergophobe

2:54 am on Oct 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you can't find a tutorial, can you find an open source script that kind of sort of roughly does what you want?

Working through that would be a tutorial in itself and, of course, hundreds of typists wait here to help you out ;-)

Seriously, working your way through code is a great way to learn and if you get stuck, we'll help out here.

one_mind

8:06 am on Oct 31, 2005 (gmt 0)

10+ Year Member



Thanks Ergo,

I didn't end up finding a script but i worked out the logic myswel. Turns out that it is really basic. But i do need help implementing the date/time functions in php/mysql.

Basically, this is the process a script goes through to add aproject.

1. Add project button clicked
2. store length of auction(int) and current time.
3. Display start date/time: now, end date: now+auction length, time left: end date-now

I can do all of the following except for find out how long the auction has left.

If a user adds a project now, sets length to 7 days then checks on it this time tommorow, i want to display the following: Time Remaining: days, hours, minutes.

I am have a hard time find the days, hours, minutes variables. I've messe around with UNIX_TIMESTAMPS ect but cant get it to work.
$get_stamp = "SELECT (UNIX_TIMESTAMP('$end') - UNIX_TIMESTAMP(now()))";
$s = mysql_query($get_stamp, $link) or die(mysql_error());
$sr = mysql_fetch_row($s);

$stamp = $sr[0];

$get_left = "SELECT $stamp, $stamp / 60, $stamp / (60 * 60), $stamp / (24*60*60), $stamp / (7*24*60*60)";
$a = mysql_query($get_left, $link) or die(mysql_error());
$sw = mysql_fetch_row($a);

$seconds = $sw[0];
$minutes = $sw[1];
$hours = $sw[2];
$days = $sw[3];
$weeks = $sw[4];

That code gives me large decimal numbers that are hard to work with. Is there an easier way to do it in php?

Thanks again :)

one_mind

9:31 am on Oct 31, 2005 (gmt 0)

10+ Year Member



Its ok,

I worked it out :)

$get_stamp = "SELECT (UNIX_TIMESTAMP('$end') - UNIX_TIMESTAMP(now()))";
$s = mysql_query($get_stamp, $link) or die(mysql_error());
$sr = mysql_fetch_row($s);

$stamp = $sr[0];

$seconds = $stamp;

$days = floor(($seconds/86400));
$rem = $seconds % 86400;
$hours = floor(($rem/3600));
$rem = $rem % 3600;
$minutes = floor(($rem/60));
$seconds = $rem % 60;