Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Alternate resources: 

Querying the database with query methods

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:08
    In this chapter, I'm going to show you how to query the database.
  • 0:12
    In your download files, you'll find a cheat sheet for this chapter.
  • 0:18
    At the very, very top is the link on
  • 0:20
    that talks about the new database abstraction layer in Dupal 7
  • 0:25
    and also the syntax for querying the database.
  • 0:28
    The first thing I want to show you is a simple SELECT QUERY.
  • 0:34
    At the top here, I have kind of commented out
  • 0:38
    kind of a pseudocode of what I'm trying to accomplish.
  • 0:41
    I want to select 3 different columns from a table,
  • 0:46
    where column1 equals value1 and column2 does not equal value2

Querying the Database with Query Methods


In this chapter we learn other ways to interact with our database beyond the simple db_select() query from the earlier video. This example walks through writing a module that that saves and displays data about how many times a user has visited a specific page. We learn about db_select(), db_insert(), db_update(), db_merge(), db_delete() and introduce the concept of "get and set" helper functions.

Log in or sign up to download companion files.

Additional resources:
There are no resources for this video. If you believe there should be, please contact us.