Considering Drupal : Database module (not drupal db)

rootuid - December 16, 2008 - 19:39

Hi,
I currently have a site cobbled together with wordpress and dadabik ( http://www.dadabik.org ). My main query is if there is a MODULE for Drupal that can query a database (mysql) and display the output for queries. At present dadabik does this on my site but I'm interested in finding out if such a module for drupal exists. I've searched the forums and module collection but unfortunately the search terms database or database module only bring up information on the drupal database.

Thanks.

Check this out:

Malthus - December 16, 2008 - 19:46

There isn't a module for

WorldFallz - December 16, 2008 - 20:06

There isn't a module for this per say, but drupal has a very nice api for interacting with non-drupal dbs. See How to connect to multiple databases within Drupal.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

Thanks for your responses

rootuid - December 16, 2008 - 21:41

Thanks for your responses guys!

Quick Q

rootuid - December 16, 2008 - 22:12

so I'm referencing the example here http://drupal.org/node/18429

To query a different database, simply set it as active by referencing the key name.

<?php
db_set_active
('mydb');

db_query('SELECT * FROM table_in_anotherdb');

//Switch back to the default connection when finished.
db_set_active('default');
?>

I've added the connection to my other db and I've created a page with the above php. When I preview the page the php is echoed to the screen and not executed. Do I need to enable php withing drupal somewhere ?

PHP Filter

mradcliffe - December 16, 2008 - 22:59

Make sure that your input format allows php code. A php filter is included as a core module. You may need to enable the module, and possibly add it to an input format in the site configuration section.

Ahh yes, I enabled the php

rootuid - December 17, 2008 - 16:48

Ahh yes, I enabled the php module and specificed the input format in the post. Many thanks.

 
 

Drupal is a registered trademark of Dries Buytaert.