Hello.

I want to understand how the support system between sites is organized, or rather, how to process and receive them can be, to give an answer.

Let's say we have three sites, on them on 3 DB. At each site form to create a message. How to make it so that when creating messages on these sites it was possible to gather them together and respond to them, so that the answers were later on these sites? Maybe someone will share information, how to do this, to make all messages recorded in another database and stored in it, and from there send a request to the sites, or how?

    1 answer 1

    1) Direct connection to the database. Write a web-muzzle with which you connect to 3 DB.

    $link1=mysql_connect("host1","user1",""); mysql_select_db("db1"); $link2=mysql_connect("host2","user2",""); mysql_select_db("db2",$link2); ... $linkN=mysql_connect("hostN","userN",""); mysql_select_db("dbN",$linkN); 

    When accessing tables, specify the key-name of the database:

     select * from `db1`.`table_message` 

    The method is difficult to manage, as when changing the number of databases, access parameters, etc. will have to edit the config files. Well, in a large number of requests you can get lost.

    2) API - for each database you create a separate host to which you connect from your admin web muzzle. On the side of the sites, write scripts to select messages, change deletion. Data is conveniently given in JSON format .

    More convenient option. On the management host, you only need a list of your APIs with access parameters.

    • thank. Your answer is the best - aa22
    • @ aa22 and if initially those same messages are to be written to a certain fourth database, and is there to process them? - namak7
    • Namak7, it is necessary that users from different sites write messages, and then I can process them and respond to them through another site, while that I have all the messages displayed and my answers displayed on their sites. At first, I wanted to do the 4th database, but this is necessary so that its contents are displayed on their sites - aa22