To display the data than not null

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
8707
Forum Newbie
Posts: 11
Joined: Thu Jan 07, 2010 7:41 pm

To display the data than not null

Post 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
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: To display the data than not null

Post by AbraCadaver »

Code: Select all

if(!empty($cfData)) {
    $desc_parent .= '<br><br>'.$cfLabel.' : <br>'.$cfData;
}
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
8707
Forum Newbie
Posts: 11
Joined: Thu Jan 07, 2010 7:41 pm

Re: To display the data than not null

Post by 8707 »

Thank a lot, Bro !!!
8707
Forum Newbie
Posts: 11
Joined: Thu Jan 07, 2010 7:41 pm

Re: To display the data than not null

Post by 8707 »

Now if i want to display "Reported Date" only, how to modify it?
Post Reply