This documentation relates to CiviCRM version 3.1. It's not maintained anymore.
Current version of documentation.

Query Debugging

Skip to end of metadata
Go to start of metadata

This page refers to outdated version of CiviCRM. Check current version of documentation.

Documentation Search

CiviCRM 3.1 Documentation

Support and Participation

Developer Resources

CiviCRM book!

Make sure to check out Understanding CiviCRM as well! You can also support this project by ordering a hard copy.

Query Debugging

In order to debug a query problem - such as unexpected duplicate rows returned by searches - you may need to see the actual queries that CiviCRM is sending to your database.

Two different approaches to this are:

  • Enable MySQL Query Logging - Add log=/var/log/mysqld.log to my.cnf and restart your MySQL server. Check out the MySQL documentation for more information.
  • Add Debug Code to CiviCRM - Add a debug statement to echo the queries in packages/DB/DataObject.php, function _query (line 2280 or so)
  • None

Creative Commons License
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-Share Alike 3.0 United States Licence.