如何从数据库表和输出数组中获取值以在Concrete5 5.8中以Formify形式使用]

问题描述 投票:0回答:1
我对从数据库填充的数组没有太多经验。

在我的控制器中,我有

$db = \Database::connection('esco_web_connection'); $dynamicStates = $db->executeQuery('SELECT * FROM Products_Premiums '); $this->set('dynamicState', $dynamicStates);

我认为我有...

foreach($dynamicStates as $dynamicState){ echo $dynamicState . "<br>"; }

但是,我得到的只是....

Array Array Array Array etc....

我在这里很茫然。我需要所有数据来设置表单下拉菜单中的条件数据。但是,我无法显示任何数据。

当我看到print_r时...

Array ( [wpp_UID] => 738452 [wpp_UpdateDate] => 2019-09-16 [wpp_ProductNumber] => 2-48 [wpp_MfrNumber] => 2 [wpp_MfrName] => Widex Hearing Aid Company [wpp_Model] => Inteo- ITC [wpp_Model2] => [wpp_State] => [wpp_PricingName] => Protection Plus [wpp_PricingStyle] => ITC [wpp_StateDefaultAnnual] => 201 [wpp_StateDefaultMonthly] => 18 [wpp_Channel] => Earserv ) Array ( [wpp_UID] => 738453 [wpp_UpdateDate] => 2019-09-16 [wpp_ProductNumber] => 2-47 [wpp_MfrNumber] => 2 [wpp_MfrName] => Widex Hearing Aid Company [wpp_Model] => Inteo- CIC [wpp_Model2] => [wpp_State] => [wpp_PricingName] => Protection Plus [wpp_PricingStyle] => CIC [wpp_StateDefaultAnnual] => 223 [wpp_StateDefaultMonthly] => 20 [wpp_Channel] => Earserv ) Array ( [wpp_UID] => 738454 [wpp_UpdateDate] => 2019-09-16 [wpp_ProductNumber] => 2-50 [wpp_MfrNumber] => 2 [wpp_MfrName] =>

我对要从数据库填充的数组没有很多经验。在我的控制器中,我有$ db = \ Database :: connection('esco_web_connection'); $ dynamicStates = $ db-> ...
php arrays output concrete5-8.x
1个回答
0
投票
尝试一下
© www.soinside.com 2019 - 2024. All rights reserved.