Skip to main content
added 30 characters in body
Source Link
db_set_active('mydatabase');    
$query = db_select('mytable', 'c');
$query->fields('c', array('number','email_address'))
->condition('number', $phoneval, '=')
->condition('email_address', $mailval, '=');
$result = $query->execute()->fetchAll();

You could use nested if

if (empty($result)) {
  // do print_r($result);
  // here you will get the result in array
   if (empty($result[0]$result['number'])) {
    form_set_error('phone_number','We have no record of that Assessment Number');
   } else if(empty($result[1]$result['email_address'])) {
   form_set_error('mail''email_address','We have no record of that email');
   }
}
db_set_active('mydatabase');    
$query = db_select('mytable', 'c');
$query->fields('c', array('number','email_address'))
->condition('number', $phoneval, '=')
->condition('email_address', $mailval, '=');
$result = $query->execute()->fetchAll();

You could use nested if

if (empty($result)) {
  // do print_r($result);
  // here you will get in array
   if (empty($result[0])) {
    form_set_error('phone_number','We have no record of that Assessment Number');
   } else if(empty($result[1])) {
   form_set_error('mail','We have no record of that email');
   }
}
db_set_active('mydatabase');    
$query = db_select('mytable', 'c');
$query->fields('c', array('number','email_address'))
->condition('number', $phoneval, '=')
->condition('email_address', $mailval, '=');
$result = $query->execute()->fetchAll();

You could use nested if

if (empty($result)) {
  // do print_r($result);
  // here you will get the result in array
   if (empty($result['number'])) {
    form_set_error('phone_number','We have no record of that Assessment Number');
   } else if(empty($result['email_address'])) {
   form_set_error('email_address','We have no record of that email');
   }
}
added 9 characters in body
Source Link
db_set_active('mydatabase');    
$query = db_select('mytable', 'c');
$query->fields('c', array('number','email_address'))
->condition('number', $phoneval, '=')
->condition('mail''email_address', $mailval, '=');
$result = $query->execute()->fetchAll();

You could use nested if

if (empty($result)) {
  // do print_r($result);
  // here you will get in array
   if (empty($result[0])) {
    form_set_error('phone_number','We have no record of that Assessment Number');
   } else if(empty($result[1])) {
   form_set_error('mail','We have no record of that email');
   }
}
db_set_active('mydatabase');    
$query = db_select('mytable', 'c');
$query->fields('c', array('number','email_address'))
->condition('number', $phoneval, '=')
->condition('mail', $mailval, '=');
$result = $query->execute()->fetchAll();

You could use nested if

if (empty($result)) {
  // do print_r($result);
  // here you will get in array
   if (empty($result[0])) {
    form_set_error('phone_number','We have no record of that Assessment Number');
   } else if(empty($result[1])) {
   form_set_error('mail','We have no record of that email');
   }
}
db_set_active('mydatabase');    
$query = db_select('mytable', 'c');
$query->fields('c', array('number','email_address'))
->condition('number', $phoneval, '=')
->condition('email_address', $mailval, '=');
$result = $query->execute()->fetchAll();

You could use nested if

if (empty($result)) {
  // do print_r($result);
  // here you will get in array
   if (empty($result[0])) {
    form_set_error('phone_number','We have no record of that Assessment Number');
   } else if(empty($result[1])) {
   form_set_error('mail','We have no record of that email');
   }
}
Source Link

db_set_active('mydatabase');    
$query = db_select('mytable', 'c');
$query->fields('c', array('number','email_address'))
->condition('number', $phoneval, '=')
->condition('mail', $mailval, '=');
$result = $query->execute()->fetchAll();

You could use nested if

if (empty($result)) {
  // do print_r($result);
  // here you will get in array
   if (empty($result[0])) {
    form_set_error('phone_number','We have no record of that Assessment Number');
   } else if(empty($result[1])) {
   form_set_error('mail','We have no record of that email');
   }
}