Solved

MYSQL V5 and higher Trigger

Posted on 2011-02-14
1
246 Views
Last Modified: 2012-05-11
Cannot find allot of info on this matter so i would appreciate  some input.

I have stock that is changed on 1 server and stock that is changed on a other. To make sure both stock levels are the same i want to insert a trigger on both servers that update the central database.

So here is a example to clarify.

SERVER 1 datebase 1 = the wepshop
SERVER 2 datebase 2 = local administration
SERVER 2 datebase 3 = central stock

If any stock from db 1 has changed i want to get the stock from db 3 and deduct or add the stock from 3 and insert the new stock into all 3 databases.
edit: also need from db 2 to db 3
Is this even possible using mysql in phpadmin?]

also note that Server 1 and 2 are at different locations with different login.









 
0
Comment
Question by:ScottNL1
1 Comment
 
LVL 24

Accepted Solution

by:
Tomas Helgi Johannsson earned 500 total points
Comment Utility
           Hi!

What about using the Fedarated storage engine ?
Using federated table in db1 and db2 where the physical table is in db3 would solve your problem
and you would have one stock table but it would be accessible in all 3 databases.
Also that would simplify the maintainance of the stock table.

http://dev.mysql.com/doc/refman/5.1/en/federated-storage-engine.html
http://dev.mysql.com/doc/refman/5.1/en/federated-create.html

Hope this helps.

Regards,
     Tomas Helgi


0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now