今天我得到错误无效的参数号:参数在我的yii应用程序更新数据时没有定义.那么我来知道我的sql数据库表列包含名称与“ – ”符号,即“表格”等.
然后我用“_”改变了“ – ”,一切正常.
这是查询代码段(我用“_”替换了“ – ”)
/* percentage losses senser*/
$attributes['totlcommloss_sensor'] = $_POST['totlcommloss_sensor'];
$attributes['asp_hour_sensor']= $_POST['asp-hour_sensor'];
$attributes['asp_daily_sensor'] = $_POST['asp-daily_sensor'];
$attributes['asp_weekly_sensor']= $_POST['asp-weekly_sensor'];
$attributes['asp_monthly_sensor'] = $_POST['asp-monthly_sensor'];
$attributes['asp_5_day_senser']= $_POST['asp_5_day_senser'];
/* cost losses */
//$attributes['costlosshourly'] = $_POST['acs-hourly'];
if (0 != intval($user['id'])) {
$command->update('alarm_settings', $attributes, 'id=:id', array(':id' => intval($user['id'])));
}
else {
$NumberOfRowsEffected = $command->insert('alarm_settings', $attributes);
}
有人可以解释为什么这个例子显示错误?提前谢谢了.