use rowCount
This commit is contained in:
@@ -147,10 +147,12 @@ function booking_variety_regn_form_validate($form, &$form_state) {
|
|||||||
// --- Check that this person hasn't already registered for variety sessions
|
// --- Check that this person hasn't already registered for variety sessions
|
||||||
$prev_regn_query = db_select('booking_variety_regn', 'v')
|
$prev_regn_query = db_select('booking_variety_regn', 'v')
|
||||||
->condition('v.booking_person_nid', $values['booking_nid'], '=')
|
->condition('v.booking_person_nid', $values['booking_nid'], '=')
|
||||||
->fields('v');
|
->fields('v')
|
||||||
$prev_regn_check = $prev_regn_query->execute();
|
->execute();
|
||||||
|
|
||||||
|
watchdog('booking_debug', 'variety session registration rowcount: <pre>@info</pre>', array('@info' => $prev_regn_query->rowCount()));
|
||||||
|
|
||||||
if ($prev_regn_check) {
|
if ($prev_regn_query->rowCount() > 0) {
|
||||||
form_set_error('booking_nid', t('You have already registered for variety sessions. Existing registration cannot be changed.'));
|
form_set_error('booking_nid', t('You have already registered for variety sessions. Existing registration cannot be changed.'));
|
||||||
watchdog('booking_debug', 'Previous variety session registration: <pre>@info</pre>', array('@info' => print_r( $prev_regn_check, true)));
|
watchdog('booking_debug', 'Previous variety session registration: <pre>@info</pre>', array('@info' => print_r( $prev_regn_check, true)));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user