[development] new dev q: are mysql queries possible within drupal?

spartaguy spartaguy spartaguy300 at gmail.com
Wed Nov 18 23:28:49 UTC 2009

Thanks to everyone that replied.

To summarise then:

 1)  I need to make a custom module.
 2) The module should have a block for displaying the query and a menu hook
 3) I can add the module to either primary links or navigation as a menu
 4) Rendered HTML using mysql commands is quite straight forward
 5) The tables being queried are easier to access within the main drupal d/b
but i can use a different db

Regarding a different db, does this command:


make *all* db queries go through customerdb or just the ones for my module?
ie will drupal have any issues accessing the data it needs from say
"drupaldb" if I dont change
the active db back again?

On Tue, Nov 17, 2009 at 9:27 AM, Earl Dunovant <prometheus6 at gmail.com>wrote:

> On Mon, Nov 16, 2009 at 7:55 AM, spartaguy spartaguy <
> spartaguy300 at gmail.com> wrote:
>>  I have two databases - one is for drupal data. The other db is for
>> customer data. Inside the customer data db is a table - customer_data.
>> I want to do a select * on customer_data in the customer database and show
>> the result on screen.
>> Can someone tell me how to do this?
> Your bare bones menu item is something like this:
>   $items['mypath/%object'] = array(
>     'title' => 'Page title',
>     'description' => 'Your description goes here.',
>     'access arguments' => array('permission string'),
>     'page callback' => 'customer_display',
>   );
> Then write a function named customer_display() that runs queries the way
> Frederik showed you and returns a string containing rendered HTML.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20091119/31933f31/attachment.html 

More information about the development mailing list