Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
database system
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
30 May 2011 at 20:28 UTC
Updated:
26 Jun 2018 at 11:35 UTC
Jump to comment: Most recent
Comments
Comment #1
dave reidIf you have the $query variable, then you can do something like drupal_set_message((string) $query) before you run $query->execute(). Otherwise you can download and enable the Devel module and call dpq($query).
Comment #2
marcusx commenteddpq($query)! Thats's cool. Didn't know it exists. Thanks a lot!
Comment #4
apotek commentedA different way, just for completeness:
Of course, if you have devel etc, dpq is great, but just wanted to document some more basic, underlying methods.
Comment #5
geigel commentedThanks apotek -- exactly what I was looking for.
Comment #6
shadab ahmad commentedYou can use dpq() function to return actual SQL query which you can directly execute in MySQL.
To use dpq() please install devel (https://www.drupal.org/project/devel) module.
Example below:
1- Go to your_base_url/devel/php
2- Print query like this.