Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

Use Silverstripe page to Load Other database


Reply

4 Posts   1889 Views

Avatar
acefx

5 March 2009 at 10:46pm Community Member, 8 Posts

Hi

I'm trying to load the content of another database and showcase it in tree on my page. The problem is that i can just get Silverstripe to load the content of the DB.
Also i want to create a drop down using : 'Issue' => 'Drop', but its not working and i also tried dropdown and list but non worked.

Can anyone help me out

Thanks

Avatar
acefx

6 March 2009 at 2:06am (Last edited: 11 March 2009 6:26pm), Community Member, 8 Posts

I was able to load the database at last by just creating a function that handles all the connection.

function tre()
   {
      
      return "This could be HTML/Text/Images or PHP";

      
      $sava = "localhost";
      $usa = "root";
      $pas = "not to worry";
      
      $db = "mysite";
      
      $con = mysql_connect($sava, $usa, $pas);
      
      $ue = mysql_select_db($db);
      
      
      
      $info = "SELECT * FROM broad";
      
      $inf = mysql_query($info) or die(mysql_error());
      
      while ($ini = mysql_fetch_array($inf, MYSQL_ASSOC))
      {
         //return "<ul><li>". $ini["id"]. "</li><li>". $ini["user"]. "</li></ul>";
      }
      
   }
   

But i can load it to the appropriate location in the page

:)

Avatar
Jainx

4 July 2011 at 10:43pm Community Member, 1 Post

Thanks for posting the function!
Gonna give it a go myself

Avatar
swaiba

4 July 2011 at 11:50pm Forum Moderator, 1796 Posts

hmmmm...

I'd do this...
http://www.silverstripe.org/customising-the-cms/show/13692#post293308

and this...
http://www.silverstripe.org/data-model-questions/show/17245#post304677