I am making a form which will load leave already availed values from mysql database. But if the value is nothing it shows nothing in the output. But i need to show 0 in the ($avail field)for the null value how to get that what i have tried is
$sqls = "SELECT (@days := a.days + @days) AS availed_days,days from tblleaves a,(SELECT @days:=0) c where
LeaveType = '$type' AND empid ='$eid' ORDER BY availed_days desc ";
$querys = $dbh -> prepare($sqls);
$querys->bindParam(':eid',$eid,PDO::PARAM_STR);
$querys->execute();
$results=$querys->fetchAll(PDO::FETCH_OBJ);
if($querys->rowCount() > 0)
{
foreach($results as $result)
{
$avail=($result->availed_days);
//$actual=($result->days);
?>
<input value=" <?php echo $avail?>" id="avail_days" name="avail_days" type="text" >