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

Alfonso Montero López amontero at tinet.fut.es
Tue Nov 24 22:08:46 UTC 2009


2009/11/19  <development-request at drupal.org>:
>>> 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
>>> item
>>>  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:
>>>
>>> db_set_active('customerdb');
>>>
>>> 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?
>>>

Maybe Table Wizard (http://drupal.org/project/tw) module can help you
to do it, also. In the docs there's info about querying external db's.
Then you will be able to views-enable any table and from this on, you
can do all sort of things, if I understood you well.
HTH.
Regards,

--
Alfonso.


More information about the development mailing list