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

Frederik Grunta fgrunta at gmail.com
Mon Nov 16 10:36:13 UTC 2009


I don't understand what you mean regarding the menu. But regarding you
question about if its possible to use a second database - yes it is,
provididing they are both the same type (ie, two Mysql databases). Change
settings.php to read:

$db_url['default'] = 'mysql://username1:password1@localhost/drupal';
$db_url['otherdb'] = 'mysql://username2:password2@localhost/otherdb';

And to query it:

db_set_active('otherdb');

//Run queries as normal

db_set_active('default');

Don't forget to set the active database back to default when you are done,
or interesting things happen.

2009/11/16 spartaguy spartaguy <spartaguy300 at gmail.com>

>
>  I want to do a select on a table and just display the results in main
> window pane.
>
> ie header is standard logo, left hand side is navigation menu.
> One of the navigation items should be able to do a query on a table in the
> local drupal database or ideally in a separate database.
>
> the mysql syntax is the easy part. its the creating a menu item that will
> do the mysql select statement and display the results in the main window
> pane.
>
> Does this make sense?
>
>
> Paul
>
>
> On Mon, Nov 16, 2009 at 10:37 AM, Nancy Wichmann <nan_wich at bellsouth.net>wrote:
>
>>  Spartaguy wrote:
>>
>> > How can I add a menu item to the Primary Links menu that will do a
>> select * from table1 and then print it out in the right hand panel?
>> Your information is less than complete.
>>
>>
>>
>> Select on what? Is there a dialog of some sort? I’m guessing what you
>> really want is a block.
>>
>>
>>
>> Nancy E. Wichmann, PMP
>>
>> Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L.
>> King, Jr.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20091116/efbaf1d7/attachment.html 


More information about the development mailing list