function ad_channel_admin_channel_validate in Advertisement 5.2
Same name and namespace in other branches
- 6.3 channel/ad_channel.module \ad_channel_admin_channel_validate()
- 6.2 channel/ad_channel.module \ad_channel_admin_channel_validate()
- 7 channel/ad_channel.module \ad_channel_admin_channel_validate()
Validate the channel.
File
- channel/
ad_channel.module, line 727 - Ad Channel
Code
function ad_channel_admin_channel_validate($form_id, $form_values) {
$chid = 0;
if ($form_values['op'] == t('Create')) {
$chid = db_result(db_query("SELECT chid FROM {ad_channel} WHERE name = '%s'", $form_values['name']));
}
else {
if ($form_values['op'] == t('Update')) {
$chid = db_result(db_query("SELECT chid FROM {ad_channel} WHERE name = '%s' AND chid != %d", $form_values['name'], $form_values['chid']));
}
}
if ($chid) {
form_set_error('name', t('A channel named %name already exists.', array(
'%name' => $form_values['name'],
)));
}
}