Hi all
I am getting null values instead of current date
<?php
$m_p_c_id = $HTTP_POST_VARS["cbo_comp"];
$lv_p_f_id=@$HTTP_POST_VARS["cbo_f_id1"];
$m_p_d_code= $HTTP_POST_VARS["cbo_dept"];
$m_p_sel_mode=@$HTTP_POST_VARS["cbo_sel_mode"];
// getting following values from table m_g_list
$m_report = " SELECT g_id,s_no,parameter,g_spec,g_type,c_id,g_c_no,s_freq,first_cal from m_g_list where c_id='$m_p_c_id' and f_id='$lv_p_f_id' and dept_code='$m_p_dept_code' ";
echo '<table><tr><td class="td">Spec</td>';
echo '<td class="td">Type</td>';
echo '<td class="td">code</td>';
echo '<td class="td">Param</td>';
echo '<td class="td">freq</td>';
echo '<td colspan="8" class="td">Sched</td>';
}
echo '</tr>';
if($m_report!="") $rc_report = $conn->execute($m_report);
//executing m_report query
if($rc_report){
$iCount = 0;
$lv_row_ctr=0;
$printedcounter=0;
$lv_row_col1 ='#FFFFFF';
$lv_row_col2 ='#EEEEEE';
while (!$rc_report->EOF )
{
$lv_g_code=$rc_report->fields[0];
$lv_sno=$rc_report->fields[1];
$lv_param=$rc_report->fields[2];
$lv_g_spec = $rc_report->fields[3];
$lv_g_typ=$rc_report->fields[4];
$lv_g_c_no=$rc_report->fields[5];
$c_code=$rc_report->fields[6];
$lv_s_freq = $rc_report->fields[7];
$lv_first_cal = $rc_report->fields[8];
// getting the values from table
if($m_p_sel_mode == 2) // checking selection mode
{
$lv_g_c_no = $comp_code; // assignment
}
else
{
$lv_sno=$rc_report->fields[1];
$lv_param=$rc_report->fields[2];
$lv_g_code=$rc_report->fields[0];
$lv_g_spec = $rc_report->fields[3];
$lv_g_type=$rc_report->fields[4];
$lv_g_code_no=$rc_report->fields[5];
$lv_sch_freq = $rc_report->fields[7];
$lv_first_cal = $rc_report->fields[8];
// checking selection mode is other than 2 getting values
$lv_g_c_no = $lv_g_c_no;
}
// querying another table to get date value
$m_freq = " select distinct m_date,s_no from tbla_g_it where f_id='$m_p_c_id' and g_code='$lv_g_code' and status='1' order by mdate desc ";
$rc_freq=$conn->execute($m_freq);
// execution of query
if ( !$rc_freq ) echo "conn fail";
if($lv_row_ctr % 2 == 0)
{
echo("<tr bgcolor=$lv_row_col1>");
}
else
{
echo("<tr bgcolor=$lv_row_col2>");
}
// checking selection mode is 1
if($m_p_sel_mode == 1)
{
echo '<td class="runningleft1">'.$lv_param.'</td>';
// displaying values
?>
<td class="runningleft1"><a href="#" onClick="javascript:window.open('view_details_i_c.php?in_no=<?php echo $lv_g_c;?>&hdn_hidden_dept=<?php echo $m_p_d_code;?>&fac_id=<?php echo $lv_p_f_id;?>&selection=<?php echo $m_p_sel_mode;?>','mywindow','menubar=1,resizable=1,scrollbars=1');" style='color:red' alt='View Details'><?php echo $c_code; ?></td>
<td class="runningleft1"><a href="#" onClick="javascript:window.open('view_details_m.php?g_code=<?php echo $lv_g_c;?>&hdn_hidden_dept=<?php echo $m_p_d_code;?>&f_id=<?php echo $lv_p_f_id;?>&sel=<?php echo $m_p_sel_mode;?>','mywindow','menubar=1,resizable=1,scrollbars=1');" style='color:red' alt='View Details'><?php echo $lv_g_c_no; ?></td>
<?php
//displaying values
echo '<td nowrap class="runningleft1">'.$lv_sch_freq.'</td>';
}
else if($m_p_sel_mode == 2) // checking selection mode is 1
{
//displaying values
echo '<td nowrap class="runningleft1">'.$lv_g_spec.'</td>';
echo '<td class="runningleft1">'.$lv_g_type.'</td>';
//displaying values
?>
<td class="runningleft1"><a href="#" onClick="javascript:window.open('view_details_g.php?g_code=<?php echo $lv_g_code;?>&hdn_hidden_dept=<?php echo $m_p_d_code;?>&facility_id=<?php echo $lv_p_f_id;?>','mywindow','menubar=1,resizable=1,scrollbars=1');" style='color:red' alt='View Details'><?php echo $comp_code; ?></td>
<td class="runningleft1"><a href="#" onClick="javascript:window.open('view_details_param.php?i_no=<?php echo $lv_g_code;?>&hdn_hidden_dept=<?php echo $m_p_d_code;?>&facility_id=<?php echo $lv_p_f_id;?>&selection=<?php echo $m_p_sel_mode;?>','mywindow','menubar=1,resizable=1,scrollbars=1');" style='color:red' alt='View Details'><?php echo $lv_param ?></td>
<?php
//displaying values
echo '<td nowrap class="runningleft1">'.$lv_sch_freq.'</td>';
}
$counter=0;
$lv_counter =0;
?>
<?php
while(!$rc_freq->EOF) //rc_freq checking till end of the table
{
$lv_m_date = $rc_freq->fields[0]; //rc_freq resultset values date data fetching
$lv_s_No = $rc_freq->fields[1]; //rc_freq s_no values date data fetching
if($lv_first_cal=="") // if lv_first_cal is null today's date to be displayed
{
$result=date("d-M-Y"); //**
}
else
{
$result = func_formatdate($lv_first_cal); // ***
}
if($counter >=4)
{
break;
}
else
{
if($result!="")
{
$lv_counter=$lv_counter+1;
?>
<td width="90px" class="runningleft1">
<?php
if($lv_counter==$counter+1){
?>
<a href="#" onClick="javascript:window.open('view_details_cal_s.php?s_no=<?php echo $lv_g_code;?>&hdn_hidden_dept=<?php echo $m_p_d_code;?>&f_id=<?php echo $lv_p_f_id;?>&no=<?php echo $lv_s_No; ?>','mywindow','menubar=1,resizable=1,scrollbars=1');" style='color:red' alt='View Details'>
<?php
// here i have problem the above ** section if lv_first_cal is null date to be displayed
// but i am getting only this output always. please solve my problem ***
echo $result; //****
?>
</a>
</td>
<?php
}
}
}
$counter=$counter+1;
$rc_freq->MoveNext(); }
?>
in this location //**** i want to display current date instead of the result please solve my problem