这是我的代码..希望你帮助我,因为我希望获得国家[' CC_FIPS']的价值,以便在我在城市的where语句中使用
$local = Input::get('locality');
$country = Input::get('country');
$resultCountry= Country::where('COUNTRY_NAME', '=', $country)->get();
//echo $resultCountry;
$resultCity= City::where('FULL_NAME_ND', '=', $local)
->where('CC_FIPS', '=', $resultCountry['CC_FIPS'])
->get();
}
echo $resultCity;
答案 0 :(得分:1)
问题是你的数组$ resultCountry没有任何带有索引CC_FIPS的元素。
如果使用函数dd()作为
,则可以看到此数组中的元素dd($resultCountry);
答案 1 :(得分:1)
background: url(logo.png);
background-size: 80px 60px;
background-repeat: no-repeat;
而不是先使用并保持代码的其余部分t =希望这会有所帮助..
答案 2 :(得分:1)
$local = Input::get('locality');
$country = Input::get('country');
$resultCountry= Country::where('COUNTRY_NAME', '=', $country)->first();
//echo $resultCountry;
$resultCity= City::where('FULL_NAME_ND', '=', $local)
->where('CC_FIPS', '=', $resultCountry['CC_FIPS'])
->get();
}
print_r($resultCity);
在第一个查询中使用Get时,结果将返回类似这样的内容。
[
[0]=>[
]
]
所以不要先使用Get,而只获得一个数组 同样在第二个查询中,您无法回显print_r所需的结果
答案 3 :(得分:0)
您可以将$ resultCountry转换为如下数组:
select 1, 'Folder' as "Technology", 'Status' as "Name_Event", count(dm1.id) as "number of items", max(TO_CHAR(TO_DATE('20000101','yyyymmdd')+(SYSDATE - dm1.time_event),'hh24:mi:ss')) as "Time in system"
from db dm1
where dm1.technology = 'Folder' and dm1.name_event = 'status1' and NOT EXISTS(SELECT 1 FROM db dm2 WHERE dm2.name_event = 'status2' and dm2.id = dm1.id)
然后$ resultCountry [' CC_FIPS']应正确返回您的值。