Forum Moderators: coopster
<?
$sql="select * from tenants where id='$id'";
$result=mysql_query($sql);
$rows=mysql_fetch_assoc($result);
$d=date ("m");
$term=($rows['term']);
if ('2008/01/01' == ($term))
{
echo "Vacant";
}
else if ($d=="01"){
$sql="SELECT SUM(jan) + SUM(jan1) + SUM(jan2)- SUM(rent) as new_jan FROM tenants where id='$id' and ann between '2008/02/01' AND '2008/12/31'";
$sql="SELECT SUM(jan) + SUM(jan1) + SUM(jan2)- SUM(rent2) as new_jan FROM tenants where id='$id' and ann between '2008/02/01' AND '2008/02/31'";
$result=mysql_query($sql);
$rows=mysql_fetch_assoc($result);
echo ($rows ["new_jan"]);
}
else if ....and I carry on with the months.
Why doesn't it work?
it will give me answer for tenant that has no term date but tenant that does comes up blank.
Thanks Guys.