Jump to content

calculate warranty expired


tulip

Recommended Posts

Hi, i am a really newbie in PHP stuck on getting the expired_date of warranty.

 

I just add date_purchase using javascript that stored the date in text of dd/mm/yyyy.

 

But i don't know how to find the expired_date according to warrantyNo provided. I try to write the if statement

 

if( $warrantyNo = '100')) {

date_purchase=+= 1*24*60;

}elseif($warrantyNo = '102') {

date_purchase=+= 2*24*60;

}elseif($warrantyNo = '102') {

date_purchase=+= 4*24*60;

}

 

I know i am very wrong but how to make it please?

Link to comment
https://forums.phpfreaks.com/topic/99645-calculate-warranty-expired/
Share on other sites

my table of warranty_reg is

warrantyNo, datetime, days

 

my codes

<?php
$calPurchaseDate = time(); //the same as now()
switch($WarrantyNo){
    case '100':
        $ calPurchaseDate += 30*24*60*60; //if warranty no is 100 then, adding 30 days in seconds
        break;
    case '102':
        $ calPurchaseDate += 60*24*60*60; //if warranty no is 100 then, adding 60 days in seconds
        break;
}
$sql = "UPDATE `warranty_reg` SET `days` = ".$ calPurchaseDate.";";
$result = mysql_query($sql);
?>

 

how to set the 'days' in my table as it still record 30days even WarrantyNo entered 100 or 102??

I don't know how to make it correctly.

please help.

 

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.