Call to undefined function db_query()

Ajay on January 31st, 2008

Drupal provides the function db_query() to interact with database.

This function is defined in includes/database.inc file.

You have to include database.inc in your file to get db_query() working.

<?php include(”includes/database.inc”); ?>

However if you are trying to access drupal database from a non-drupal .php file then all you need to do is to include following lines at the top of your file.

require_once ‘./includes/bootstrap.inc’;
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

Bookmark and Remember: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • Furl
  • Sphinn
  • Facebook
  • Mixx
  • Google
  • Live
  • YahooMyWeb
  • Technorati
  • blinkbits
  • TwitThis
  • BlinkList
  • StumbleUpon
  • Spurl
  • PlugIM
  • blogmarks
  • Blue Dot
  • TailRank
  • Fark
  • Blogsvine
  • Netvouz
  • NewsVine
  • ppnow
  • Ma.gnolia
  • Taggly
  • MisterWong
  • Simpy
  • Propeller
  • Slashdot
  • Pownce
  • Bumpzee
  • co.mments
  • Blogosphere News

Leave a Reply

You must be logged in to post a comment.