Project

General

Profile

Bug #45067 » set-pids.php

Christian Bernet, 2013-02-20 14:00

 
<?php
//nur hier anpassen
$database = 'db';
$user = 'user';
$password = 'pw';

mysql_connect('localhost',$user,$password);
mysql_select_db($database);

//tt_content+image
$resultFileReference = mysql_query("select uid, uid_foreign from sys_file_reference where tablenames='tt_content' and fieldname='image'");
while ($rowFileReference = mysql_fetch_assoc($resultFileReference)) {
$resultContent = mysql_query("select uid, pid from tt_content where uid=".$rowFileReference['uid_foreign']);
$rowContent = mysql_fetch_assoc($resultContent);
$resultUpdate = mysql_query("update sys_file_reference set pid=".$rowContent['pid']." where uid=".$rowFileReference['uid']);
echo 'fileReference with uid: '.$rowFileReference['uid'].' is on page '.$rowContent['pid'].'/successful<br />';
}

//pages+media
$resultFileReference = mysql_query("select uid, uid_foreign from sys_file_reference where tablenames='pages' and fieldname='media'");
while ($rowFileReference = mysql_fetch_assoc($resultFileReference)) {
$resultUpdate = mysql_query("update sys_file_reference set pid=".$rowFileReference['uid_foreign']." where uid=".$rowFileReference['uid']);
echo 'fileReference with uid: '.$rowFileReference['uid'].' is on page '.$rowFileReference['uid_foreign'].'/successful<br />';
}
mysql_free_result($resultFileReference);
?>
(2-2/2)