Drupal 7 Views provides an option to add php to the Views footer in a View page. The option is called Global PHP. It allows you to add PHP code to views, to modify its output without adding code in a separate php file. However this option shoud be used with caution as a php error here can bring down the whole site and it would be difficult to detect. There is an alternative though. Read on to know how to add an SQL query to the global footer in Views without directly placing the PHP code in a view.
SQL Query
Sometimes working on Drupal Views is very intimidating as this a very complex module
serving a variety of needs. No wonder it is one of top Drupal modules. Once I had a particularly
difficult time trying to figure out how to get a relationship right in Views by trying to get the user
name from the users table using a userid from a field in my custom table. However I managed to
figure out the soution by reading the query generated by Views. Read on to know how to add a relationship
between a custom table and Users table in Views below
Drupal 7 supplies developers with a platform neutral format for generating database queries. If you are a Drupal developer, you might need to see the actual SQL query that is generated by Drupal for debugging and testing purposes. If you would like to know how to print an SQL query with arguments while using db_select in Drupal 7 then read on to find out the solution.
Testing is a very significant phase in the development of Drupal based websites. In this article we are going to discuss how to write test cases for numeric and alphanumeric fields on a Drupal site