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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

2 Databases


Go to End


4 Posts   1550 Views

Avatar
JZM

Community Member, 34 Posts

17 July 2008 at 10:34pm

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

Avatar
Sam

Administrator, 690 Posts

18 July 2008 at 3:03pm

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.

Avatar
JZM

Community Member, 34 Posts

8 August 2008 at 12:53pm

what files would I place the MySQL Code into

Avatar
Fuzz10

Community Member, 791 Posts

9 August 2008 at 12:40am

subscribe