The $wpdb
object has some properties getting set for that:
1 2 3 4 5 6 7 8 9 10 | global $wpdb; // Print last SQL query string echo $wpdb->last_query; // Print last SQL query result echo $wpdb->last_result; // Print last SQL query Error echo $wpdb->last_error; |
Note: First of all you have to set define( ‘SAVEQUERIES’, true ); in your wp-config.php file at root folder of WordPress.
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.