Page 1 of 1

To display the data than not null

Posted: Mon Feb 01, 2010 8:26 pm
by 8707
By refer to below code :

Code: Select all

$sql = "SELECT * FROM vtiger_ticketcf WHERE ticketid = ?";
        $result = $adb->pquery($sql, array($id));
        $cffields = $adb->getFieldsArray($result);
        foreach ($cffields as $cfOneField)
        {
            if ($cfOneField != 'ticketid')
            {
                $cfData = $adb->query_result($result,0,$cfOneField);
                $sql = "SELECT fieldlabel FROM vtiger_field WHERE columnname = ? and vtiger_field.presence in (0,2)";
                $cfLabel = $adb->query_result($adb->pquery($sql,array($cfOneField)),0,'fieldlabel');
                $desc_parent .= '<br><br>'.$cfLabel.' : <br>'.$cfData;
            }
        }
Sample output :

Module : account

Issue Description : testing case

Attachment URL :

Reported Date : 2010-02-01

Reported By :

Resolved Date :

Resolved By :

How to change the code in order for me to display the fields "Module, Reported Date, Issue desc" only. The blank fields will not be display!

Desired output :

Module : account

Issue Description : testing case

Reported Date : 2010-02-01

Re: To display the data than not null

Posted: Mon Feb 01, 2010 8:42 pm
by AbraCadaver

Code: Select all

if(!empty($cfData)) {
    $desc_parent .= '<br><br>'.$cfLabel.' : <br>'.$cfData;
}

Re: To display the data than not null

Posted: Mon Feb 01, 2010 9:07 pm
by 8707
Thank a lot, Bro !!!

Re: To display the data than not null

Posted: Mon Mar 22, 2010 1:11 am
by 8707
Now if i want to display "Reported Date" only, how to modify it?