title: How do I fetch a data from an external database into my wordpress home
body: <p>I have a WordPress site installed in a subfolder of my host and another old site in the public_HTML. I'll like to fetch some data (a marquee text to be used around the header on the index of my WordPress home) from the old site to the new site(note, the two sites have a different database). I already have a php code that fetches the data.</p>
  
  <pre class="lang-php prettyprint-override"><code>//test.php
  
  &lt;?php
  include_once("admin/includes/config.php");
  include_once("admin/includes/db.class.php");    
  $db = new DB; $db -&gt; open();
  $strScrollingText = '';
  $db -&gt; query("select * from anouncements where status = 1 
  order by id desc");
  if ($db -&gt; rows() &gt; 0)
          {
      $strScrollingText .= '&lt;MARQUEE scrolldelay="100" 
  direction="left"&gt;';
      while ($rs = $db -&gt; rsset())
      $strScrollingText .= stripslashes($rs['anouncement']) . ', 
  ';
      $strScrollingText .= '&lt;/MARQUEE&gt;';      
      }
  
  ?&gt;
  </code></pre>
  
  <p>When test.php above is placed in my root directory and ran, it outputs a marquee text from the database. Then I moved the file into my themes folder (of course, I adjusted the db include file path using ../)  and tried to include the test.php using include('test.php); in the <code>&lt;head&gt;</code> of my theme's header.php, but when I refreshed my homepage, it was blank. I even copied the content of test.php into the <code>&lt;head&gt;</code> and removed the 'echo $strScrolling text; ' and place it where and want it to appear but the homepage was still blank. I also use the the #include directive in my Themes functions.php but this made my whole WordPress crash (I had to go and edit the file through cpanel to restore my wp).<br>
  I don't know where am doing this wrong and it's really frustrating and I need any help I can get. I would even appreciate if I can get this done using a plugin.</p>