This should give you a start. Don't forget to edit settings.php and change 1st line to you database name<br><br>db_set_active('customerdb');<br>$result = db_query("SELECT * FROM {customer_data}");<br>
db_set_active('default');<br>while ($row = db_fetch_object($result))<br>{<br> print_r($row);<br>}<br><br><br><div class="gmail_quote">2009/11/16 spartaguy spartaguy <span dir="ltr"><<a href="mailto:spartaguy300@gmail.com">spartaguy300@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br><br><br> 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.<br>
<br>I want to do a select * on customer_data in the customer database and show the result on screen.<br>
<br>Can someone tell me how to do this?<div><div></div><div class="h5"><br><br><br><br><div class="gmail_quote">On Mon, Nov 16, 2009 at 7:36 PM, Frederik Grunta <span dir="ltr"><<a href="mailto:fgrunta@gmail.com" target="_blank">fgrunta@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">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:<br>
<p>$db_url['default'] = 'mysql://username1:password1@localhost/drupal';<br>
$db_url['otherdb'] = 'mysql://username2:password2@localhost/otherdb';</p><p>And to query it:</p><p>db_set_active('otherdb');</p><p>//Run queries as normal</p><p>db_set_active('default');<br>
</p><p></p>Don't forget to set the active database back to default when you are done, or interesting things happen.<br><br><div class="gmail_quote">2009/11/16 spartaguy spartaguy <span dir="ltr"><<a href="mailto:spartaguy300@gmail.com" target="_blank">spartaguy300@gmail.com</a>></span><div>
<div></div><div><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br> I want to do a select on a table and just display the results in main window pane.<br>
<br>
ie header is standard logo, left hand side is navigation menu.<br>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.<br>
<br>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.<br><br>Does this make sense?<br><br><br>Paul<div><div></div><div>
<br><br><div class="gmail_quote">
On Mon, Nov 16, 2009 at 10:37 AM, Nancy Wichmann <span dir="ltr"><<a href="mailto:nan_wich@bellsouth.net" target="_blank">nan_wich@bellsouth.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Spartaguy
wrote:</span></p>
<p class="MsoNormal"></p><div><span style="color: rgb(31, 73, 125);">>
</span>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?<br>
</div><span style="color: rgb(31, 73, 125);">Your information
is less than complete.</span>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Select
on what? Is there a dialog of some sort? I’m guessing what you really
want is a block.</span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>
<div>
<p class="MsoNormal"><span style="font-size: 14pt; font-family: "Comic Sans MS"; color: fuchsia;">Nancy E. Wichmann, PMP </span><span style="font-size: 14pt; color: rgb(31, 73, 125);"></span></p>
</div>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(31, 73, 125);">Injustice anywhere is a threat to justice everywhere. -- Dr.
Martin L. King, Jr</span><span style="font-size: 10pt; color: rgb(31, 73, 125);">.</span><span style="font-size: 11pt; color: rgb(31, 73, 125);"></span></p>
</div>
</div>
</blockquote></div><br>
</div></div></blockquote></div></div></div><br>
</blockquote></div><br>
</div></div></blockquote></div><br>