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.

Archive

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

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

2 Databases


Reply

4 Posts   1298 Views

Avatar
JZM

17 July 2008 at 10:34pm Community Member, 34 Posts

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

18 July 2008 at 3:03pm Administrator, 685 Posts

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

8 August 2008 at 12:53pm Community Member, 34 Posts

what files would I place the MySQL Code into

Avatar
Fuzz10

9 August 2008 at 12:40am Community Member, 787 Posts

subscribe