root | fr--french documents | de--german documents
Link fields together so their values always match
2) Set "doc_id" T.V. to the same value as "id" for all documents (before original docs are duplicated).Well. I’m at step 2.

FOR EACH id FROM mydb_site_content
BEGIN
INSERT INTO mydb_site_templvar_contentvalues
VALUES (AutoIncrementedId, 22, mydb_site_content.id, mydbsite_content.id)
ENDINSERT INTO mydb_site_templvar_contentvalues VALUES (DEFAULT, 22, mydb_site_content.id, mydbsite_content.id)
<?php
/* include connexion parameters */
require("param.inc.php");
/* connect the MySql server */
$connexion = mysql_connect($server, $login, $password) or
die("Impossible to connect server $server");
/* connect the database */
mysql_select_db($db) or die("Impossible to connect the $bd database");
/* select identifiers of all MODx documents */
$table = "mydbsite_content";
$request= "SELECT id FROM $table";
$result = mysql_query($request);
while ($id = mysql_fetch_row($result) ) /* for each document */
$table = "mydb_site_templvar_contentvalues";
// 22 is here the number of the TV the document identifier shared by all translations of the document
// for the document with id $id, set value for TV #22 to $id.
$request= "INSERT INTO $table VALUES (DEFAULT, 22, $id, $id)";
mysql_close($connexion);
?>INSERT INTO modx_site_tmplvar_contentvalues (tmplvarid, contentid, value) SELECT 22, id, id FROM modx_site_content
SELECT 22, id, id FROM modx_site_content
<?php
// Don't forget to set manually the 2nd VALUE
// in the INSERT INTO request with the number or the TV to update.
// Also set the correct MODx database prefix at the beginning or the table names.
/* include connexion parameters */
require("db_connexion_params.inc.php");
/* connect the MySql server */
$connexion = mysql_connect($server, $login, $password) or
die("Impossible to connect server $server");
echo "$server server connected<br>";
/* connect the database */
mysql_select_db($db) or die("Impossible to connect the $bd database");
echo "$db database connected<br>";
/* select identifiers of all MODx documents */
$table = "dbprefix_site_content";
$request= "SELECT id FROM $table";
$result = mysql_query($request);
// WHAT FOLLOWS DOES NOT WORK AS TABLE alti_site_templvar_contentvalues IS NOT UPDATED
// STRANGELY, NO ERROR IS DISPLAYED. LIKE IF THEY WERE NO ROWS IN $result
$table = "dbprefix_site_templvar_contentvalues";
while ($id = mysql_fetch_row($result) ) { /* for each document */
$request= "INSERT INTO $table VALUES (DEFAULT, 22, $id, $id)";
// 22 is here the number of the TV the document identifier shared by all translations of the document
// for the document with id $id, set value for TV #22 to $id.
}
echo "Closing MySQL connexion<br>";
mysql_close($connexion) or die("Impossible to close the MySQL connexion.");
echo "MySql connexion closed.";
?><?php $server="localhost"; $login="root"; $password=""; $db="mydatabase"; ?>
Not an expert in SQL, but I’m perplex about your syntax here,
SELECT 22, id, id FROM modx_site_content
as in the _site_content table, there is no column name with the number of the TV.