Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7853047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:34:07+00:00 2026-06-02T19:34:07+00:00

i have a db (let’s call it A ) i need the informations to

  • 0

i have a db (let’s call it A)

i need the informations to be in multiple DB’s (B, C, D needs EXACTLY the same informations)

can i make something that will auto-update all of them every (X) hours?

#

i need this in order to sync 2 joomla components using IIS 7 / php.

Tryed (works nice the first time, but then if one is changed it goes fked up because there’s no Primary in this component):

#

Getting my data

$mysqli = @new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_WORLD);

/* Vérification de la connexion */
if (mysqli_connect_errno()) {
    die("&error=".mysqli_connect_error()."&");
    exit();
}


$query = "  SELECT  table_name
            FROM    information_schema.tables
            WHERE   table_name LIKE '%XXXXXXX%'";

$arrTableList   = array();
$allInArray     = array();
if ($result = $mysqli->query($query)) {

    /* Récupère un tableau d'objets */
    while ($obj = $result->fetch_object()) {
        $arrTableList[] = $obj->table_name;
    }

    /* free result set */
    $result->close();
}

foreach($arrTableList as $key => $value){

    $query = "  SELECT  *
                FROM    $value";

    if ($result = $mysqli->query($query)) {

        /* Récupère un tableau d'objets */
        while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
            $allInArray[$value][] = $row;
        }

        /* free result set */
        $result->close();
    }

}

the insertion function

function toSwich($newDb, $tmpTag){
    global $mysqli;
    global $allInArray;
    global $tag1;

    $mysqli->select_db($newDb);

    foreach($allInArray as $table => $tableArrayData){

        $table  =   str_replace ($tag1, $tmpTag, $table);
        foreach($tableArrayData as $uselessKey => $valueArray){
            $keyList    = "";
            $valueList  = "";
            $query = "SELECT COUNT(*) FROM $table WHERE ";
            foreach($valueArray as $key => $value){
                $key        =    $mysqli->real_escape_string($key);
                $value      =    $mysqli->real_escape_string($value);

                $keyList    .=  $key . ",";
                $valueList  .=  "'" . $value . "',";

                $query      .=  " $key = '$value' AND";
            }

            $query      =   substr($query,0,-3);
            $valueList  =   substr($valueList,0,-1);
            $keyList    =   substr($keyList,0,-1);

            if(!$result = $mysqli->query($query)){
                print_r($mysqli->error);
                echo "<br />";
                print_r($query);
                echo "<br />";
                exit();

            }
            $row = $result->fetch_row();
            if((int)$row[0] == 0){
                if(!$mysqli->real_query("INSERT INTO $table ($keyList) VALUES ($valueList)")){
                    print_r($mysqli->error);
                    exit();
                }
            }
        }
    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:34:08+00:00Added an answer on June 2, 2026 at 7:34 pm

    Configure a Master-Slave replication schema, I’ll keep the databases synced constantly

    Here its an example how to configure replication: 3 Jump Steps to Configure Master Slave Replication in Mysql

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like create a custom DataRow that will have -let's say- a propery
For simplicities sake, I'll make up a similar example to what I have: Let's
Alright so I have a task, that I have to let the client try
I have a UIViewController — let's call it FormController — which is simply a
I have three branches (let's call them master, testing, and feature). All three are
Ok, so I have let's say this page http://mypage.com/index.php?id=something . I want to have
First I have to let you know that i am a newbie in this
I have let's say two pc's.PC-a and PC-b which both have the same application
I have asp.net's .aspx page. that have GridView let say GridViewParent and Each row
Ok, I'm working on a php college project, and I have to let students

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.