1

I have a very simple node type set up in drupal, see it here

And I'm trying to get the node id based on the email field (the email is unique to each node, just like the nid). My query looks like this:

$query  -> entityCondition('entity_type', 'node')
-> entityCondition('bundle', 'mail_entry')
-> fieldCondition('field_email', 'value', $email);

But drupal is complaining with:

"PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_data_field_email0.field_email_value'"

I don't really understand what's wrong.

1 Answer 1

2

At a guess you're using the Email Field module to provide that particular field?

If so, the column name is email, not value, so your code should be:

$query->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'mail_entry')
  ->fieldCondition('field_email', 'email', $email);
2
  • Thanks, I worked this out not too long ago. This works perfectly. Commented Jul 31, 2012 at 1:02
  • It seems this Exeption is generally thrown if the column parameter of the fieldCondition() method is wrong.
    – kask
    Commented Jun 24, 2014 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.