Jump to content

Recommended Posts

If I have several databases, each with their own website.  I need to have one main website database with all these individual database records duplicated in it...what is the best way to do that? 

I will need to change the data in the individual databases at the store level daily and have the changes update both on the individual sites and the main website with all the smaller sites 'feeding' to it somehow...

For info, if an item is selected in the main large database, the browser will be linked back to the individual website from which that data came...thanks.

I'm interested in the method here so that I will know how to approach the php script to make this all happen.  Thanks again.
Link to comment
https://forums.phpfreaks.com/topic/29389-feed-database-info-to-multiple-sites/
Share on other sites

You could setup a cron job to backup the databases to a sql file, then FTP it to your main server. Your main server then just needs a cron job that takes place about 20 minutes later, that truncates the tables and then reads the sql files.

Or, if this isn't private data, you could have each site generate a sql or csv file and post it on the respective webserver with a cron job. Then have your main site fetch all the files.
that sounds about like what I want to do...I just don't know much about cron jobs.  it's not private data, it's publicly for sale inventory.  However, there are security issues for the servers, like preventing injection problems, viruses, etc...

Thanks.
I'd suggest going the other way.  Have one database (the big one you mentioned) with all the data in it.  Then have all the websites only select the content they need for their individual site.

It's a lot easier to do it this way than in reverse the way you're doing it, and it means only one database to maintain.

The disadvantage is may have to modify your database structure a little, carry out some normalisation on it to make it a feasible solution.

Regards
Huggie
I'm concerned about security.

I don't want each site to have that kind of access to the main site with all the data in it.

The way I suggest, if one individual database or website administrator messes up, then only one small site is affected.  The other small databases are still feeding the main ad site.

I don't mind the extra work.  I hope to get php to handle most of that for me anyway...
Let's say five boat dealers have each a website.  Each has a database.  Say I maintain one master database with their inventory altogether hosted on it and advertise that website with the main database. 

Each dealer could log on to his site and update inventory daily.  At the end of the day, I'd like the main website updated automatically to update the main website data.  That way, if a browser stopped by the main website and wanted to see inventory from all five dealers, he could and the data would be fresh and accurate through that day...

I would not want each dealer to be logging into the  main site database for obvious reasons.  Say an employee of one dealer got mad and took down the site?  Say there was some error by a dealer and he deleted his database.  I know it might be rare, but these things happen. 

I'd much rather each dealer be dealing with his own database only than the main database.  Does that make any sense?  That's my take on it.  Now, how do I make that happen?  What method is best for the main database site to get its updates?  Is it cron jobs?  Is it a repetitive php file from the main site?  Is it a daily repetitive file from each small site?  What's the best way? 

opinions are appreciated.  Thanks.
Tracy:
This is where Database permissions come in handy. Only allow them insert and select statements on their respective accounts, and not delete / drop / create etc etc. Also, only allow them to use a certain table, or set of tables in such database.

If you need help in setting ti up properly, don't hesitate to ask.

- Keeb
[quote author=tracy link=topic=117288.msg478546#msg478546 date=1165252878]
I would not want each dealer to be logging into the  main site database for obvious reasons.  Say an employee of one dealer got mad and took down the site?  Say there was some error by a dealer and he deleted his database.  I know it might be rare, but these things happen. 
[/quote]

This indicates poor coding and database design, with the correct permissions for database users and well designed queries in the php, you can prevent this from happening.

Regards
Huggie
[quote author=keeB link=topic=117288.msg478547#msg478547 date=1165253235]
Tracy:
This is where Database permissions come in handy. Only allow them insert and select statements on their respective accounts, and not delete / drop / create etc etc. Also, only allow them to use a certain table, or set of tables in such database.

If you need help in setting ti up properly, don't hesitate to ask.

- Keeb
[/quote]

So the users could add/edit/delete their own stuff, not others...?...
And you think this would be just as safe as having the main site draw from the other sites' db?
I could 'secure it like crazy' to prevent it going down on a whim?...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.