0

I would like to connect to the database from a Drupal 7 module. Currently I only have the query I want to run which is:

$query = db_select('z_lists)
->fields('country')
->condition('value', $country, '=')
->execute()
->fetchAssoc();

What I can't figure out is how to establish a connection to the default database.

Any help?

0

Just execute the query, Drupal takes care of everything else.

If it doesn't work, then that's for another reason.

Also, see Given that db_select is much slower than db_query, why would I want to use it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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