Today I got error Invalid parameter number: parameter was not defined in my yii app while updating data . then i come to know that my sql database table column contains name with "-" symbol i.e "table-post" etc .
Then i changed "-" with "_" and everything is working .
This is the query snippet (I replaced the "-" with "_")
/* 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);
}
Can some one explain why this example shows error? Many thanks in advance.