Hlep with field array!

2 posts by 2 authors in: Forums > CMS Builder
Last Post: February 13, 2014   (RSS)

By nmsinc - February 12, 2014

Need some help with a listing config file below:

I have set $num to the value of a field in the first line of code below.

The next line of code works just fine if I add the exact number such as "177"; however, if I use the value  $num as: $tables_filters=array('`cms_accounts`.`member_company_accounts` is = $num'); the report returns null when there is data to report. Any help would be appreciated! - Thanks NMSINC

<?php
$num =($CURRENT_USER['member_company_accounts']);
$tables_filters=array('`cms_accounts`.`member_company_accounts` is = "177"');
$fields=array('num','username','fullname','address','city','state','zip','email','phone','cell','lastLoginDate','disabled','member_company_accounts');
$fields2=array('num','username','fullname','address','city','state','zip','email','phone','cell','lastLoginDate','disabled','member_company_accounts');
$labels=$labels = 'a:13:{s:3:"num";s:14:"Account Number";s:8:"username";s:9:"User Name";s:8:"fullname";s:9:"Full Name";s:7:"address";s:12:"Port Address";s:4:"city";s:9:"Port City";s:5:"state";s:10:"Port State";s:3:"zip";s:13:"Port Zip Code";s:5:"email";s:13:"Email Address";s:5:"phone";s:12:"Phone Number";s:4:"cell";s:11:"Cell Number";s:13:"lastLoginDate";s:15:"Last Login Date";s:8:"disabled";s:18:"Is Acount Disbaled";s:23:"member_company_accounts";s:14:"Member Company";}';;
$group_by=array('member_company_accounts');
$sort_by=array(array('fullname','1'));
$layout='AlignLeft2';
$style_name='soft-black';
$Forget_password='';
$security='';
$members='';
$sec_Username='';
$sec_pass='';
$sec_table='';
$sec_Username_Field='';
$sec_pass_Field='';
$sec_email='';
$sec_email_field='';
$title='User Accounts';
$date_created='13-Feb-2014 08:09:09';
$header='';
$footer='';
$file_name='Users';
$records_per_page='10';
$chkSearch='Yes';
$is_mobile='';
?>

nmsinc

By Dave - February 13, 2014

Hi nmsinc, 

I'm not familiar with the way this data is formatted or how you're using it, but I think the problem is the quotes.

Single quotes just store the value as is: print '$num'; // outputs $num

Double quotes "interpolate" (replace) variables with values: print "$num"; // outputs 177

Instead of this: 

$tables_filters=array('`cms_accounts`.`member_company_accounts` is = $num'); 

Try this:

$tables_filters=array("`cms_accounts`.`member_company_accounts` is = $num"); 

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com