Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » 2 Databases

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1291 Views
  • JZM
    Avatar
    Community Member
    34 Posts

    2 Databases Link to this post

    Hello,

    I'm wanting to use SS for a client. This client has a huge database of products (will set up another mysql database with all the products descriptions links to images ect). What I was wanting to know what would be the easiest way to connect the 2 databases togeather for example if the client updates the information on page "pens" it will send the data from the SS database and into my custom database.

    Sorry if this is confusing I wrote it how I thought o

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: 2 Databases Link to this post

    You could write an API to connect the two, but that would be a lot of work.

    Or, you could make custom DB::query() calls and convert them into a DataObjectSet containing ArrayData objects. Here's a quick example of you could do that.

    $output = new DataObjectSet();
    foreach(DB::query("SELECT * FROM OtherDB.Table") as $record) {
    $output->push(new ArrayData($record));
    }

    $output could then be rendered into SilverStripe templates.

  • JZM
    Avatar
    Community Member
    34 Posts

    Re: 2 Databases Link to this post

    what files would I place the MySQL Code into

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: 2 Databases Link to this post

    subscribe

    1291 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.