Jump to content

Set the status to Open after 24 hours.


sanfordss

Recommended Posts

 

I have this script that does not work and I don't know why. I'm not very good at php, so I'm hoping the PHP Freaks can give a hand. Here's how it's supposed to work- The status of a request is set to hold when a proposal is accepted. the tech has 24 hours to confirm the acceptance. If 24 hours goes by, that request should go back to Open. Sounds simple, but it just won't work. Here's what I have. Any insight would be appreciated...

 

 

//check whether or not a request on hold should be reopened

 

function f_check_reopen_request($connection, $reqid){

 

$query = "select * from `bidding` where `b_reqid`='$reqid' and `acc_rej`='accepted'";

 

$result = $connection->query($query);

 

if($result->num_rows > 0){

 

$bid = f_create_result_array($result);

 

$now = mktime();

 

$dates = explode(" ", $bid[0]['acc_rej_timestamp']);

 

$times = explode(":", $dates[1]);

 

$my_dates = explode("-", $dates[0]);

 

$accept_time = mktime($times[0],$times[1],$times[2],$my_dates[1],$my_dates[2],$my_dates[0]);

 

//$difference = floor(($now - $accept_time) / (24 * 60 * 60));

 

$difference = floor(($now - $accept_time)/(600));

 

if($difference > 1){

 

//set the request and bids back to open

 

f_set_request_status($connection, $reqid, "open");

 

$bids = f_get_request_bids($connection, $reqid);

 

foreach($bids as $bid){

 

f_set_bid_status($connection, "open", $bid['bid_id']);

 

}

 

return true;

 

}else{

 

return false;

 

}

 

}else{

 

return false;

 

}

 

}

 

 

Link to comment
https://forums.phpfreaks.com/topic/193939-set-the-status-to-open-after-24-hours/
Share on other sites

Archived

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

×
×
  • 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.