公司可以拥有许多经营的行业,例如工程公司可以在结构,机器人,电子等领域运营......
我有一个预设扇区表:
$sectors = array('structural', 'robotics', 'environment'); // shortened as too long to post here
foreach ($sectors as $sector){
$s = R::dispense( 'sector' );
$s->name = $sector;
R::store($s);
}
我有一张公司表,当我从表单中选择一个或多个扇区时,我想将它分配给公司:
$sectors = array_keys($_POST['sectors']);
foreach($sectors as $sector){
echo $sector;
//$s = R::findOne( 'sector',' name = ? ', "$sector" );
$s = R::findOne( 'sector', ' name = ? ', array($sector) );
$company->sharedSectorList[] = $s); // seems to stop working here
}
// other stuff goes here
$id = R::store( $company );
我的页面顶部有以下内容:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
但是,没有显示错误,它只是说HTTP错误500,目前无法处理此请求。它似乎停止在 - > sharedSectorList []行停止工作。