I want result as Not Available if value is null or 0000-00-00 or 1971-01-01Hi, this is a code , which I used for showing results from 3 tables.
Lease_North is my main table.
When I join with another 2 tables using Left, if there is not value exist in table 2 and table 3 then its shows date 1-January-1971. although I used if condition to control, but its showing again and again 1971 date.
please help me out.
<?php
include("config.php");
$result = mysql_query("SELECT tb.LAPeriodStart,tb.code,Year(lp.durations),Year(lp.duratione),lp.pDate,lp.rDate,lp.siteid,lc.cDate
FROM lease_north as tb
Left JOIN limsrentpayment as lp ON tb.Code =mid(lp.SiteID,7)
Left JOIN limscheaquesdispatched as lc ON tb.code = mid(lc.SiteID,7)
WHERE tb.SiteId REGEXP '$a'");
while($row = mysql_fetch_array($result))
{
echo "<tr>";
if($row[2]!='')
{
echo "<td >" . $row[2] . "-" . $row[3] . "</td>";
}
else
{
echo "<td>Not Available</td>";
}
echo "<td colspan >" .date("j-F",strtotime($row[0])). "</td>";
if($row[4]!='0000-00-00')
{
echo "<td>" .date("j-F-Y",strtotime($row[4])). "</td>";
}
else
{
echo "<td>Not Available</td>";
}
echo "<td>Not Available</td>";
if($row[5]!='0000-00-00' )
{
echo "<td>" .date("j-F-Y",strtotime($row[5])). "</td>";
}
else
{
echo "<td>Not Available</td>";
}
if($row[7]!='')
{
echo "<td>" .date("j-F-Y",strtotime($row[7])). "</td>";
}
else
{
echo "<td>Not Available</td>";
}
echo "<td>Not Available</td>";
if($row[7]!='')
{
echo "<td> Complete </td>";
}
else
{
echo "<td> Incomplete </td>";
}
echo "</tr>";
//$b =$row['SiteId'];
}
?>