Custom sql querys in drupal

I wanted to create a view to a block that displays latest 2 news, courses that haven´t started yet and vacancies if existing. This is addressed with a union query that is written into a module. Followed this tutorial:

http://sethsandler.com/software/drupal-6-creating-activity-stream-views-custom-sql-query-merging-multiple-views-part-1/comment-page-1/#comment-4637

It is a good idea to debug custom sql queries with phpmyadmin. Correct formatting of the custom made php modules is crucial, as the opening php tag and the commented $Id have to be in different lines, as such:

<?php
// $Id: custom_views.module,v 1.272.2.1 20010/05/07 12:25:24 goba Exp $

…otherwise we can get “cannot modified header information – headers already sent by” error, as detailed in: http://drupal.org/node/128832

Advertisements

Posted on July 7, 2010, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: