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   1328 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, 685 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, 787 Posts

9 August 2008 at 12:40am

subscribe