Question

I think the question says it all. I am not sure how to get the currentdate + 2 days. here was my attempt

//insert invoice table
                $currentdate = getdate();
                $duedate = getdate() + 2000;
                $makeinvoice = mysql_query("INSERT INTO invoices (userid, hostid, price, ispaid, detecreated, duedate) VALUES ('$userid', '$prodid', '$initprice', '0', '$currentdate','$duedate' )",$conn);
Was it helpful?

Solution

am assuming you want to get a unix timestamp. just use strtotime('+ 2 days')

EDIT

//insert invoice table
$currentdate = time();
$duedate = strtotime('+2 days');

$makeinvoice = mysql_query("INSERT INTO invoices (userid, hostid, price, ispaid, detecreated, duedate) VALUES ('$userid', '$prodid', '$initprice', '0', '$currentdate','$duedate' )",$conn);

P.S, you should use the mysqli extention as mysql is old and would be discontinued soon. Or better still, use pdo

OTHER TIPS

This should return a timestamp 2 days ahead

$due_date = strtotime('+ 2 days');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top