calculate days late

I need to calculate the # of days late (dayslate)(# of days from the duedate to the current date. Below is my code.
[php]<?php
$stat = mysql_connect(“localhost”,“root”,"");
$stat = mysql_select_db(“oodb”);
$query = “SELECT charges, dayslate FROM oocust Where WHERE payrec = ‘R’ AND pd = ’ '”;
$stat = @mysql_fetch_assoc(mysql_query($query));
echo $stat[“charges”];
$result= mysql_query(“select * from oocust”);
while($row=mysql_fetch_array($result))
{
$id=$row[‘id’];
$dayslate=$row[‘dayslate’];
$duedate=$row[‘duedate’];
$tax=$row[‘tax’];

// sysdate = date(“m/d/y”);
// if(strtotime($sysdate) > (strtotime($row[“duedate”]) +2600000)

}
$sql = “UPDATE oocust SET
tax = charges * .06,
dayslate = ‘$dayslate’
WHERE id=’$id’”;
mysql_query($sql) ;
$err=mysql_error();
if($err!=""){
echo “Error in $sql: $err\n”;
}
}
echo “Records have been updated”;
?> [/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service