updated update script and merged lobbylens admin scripts
[contractdashboard.git] / admin / linkAmendments.php
blob:a/admin/linkAmendments.php -> blob:b/admin/linkAmendments.php
<?php <?php
include_once ("../lib/common.inc.php"); include_once ("../lib/common.inc.php");
$query = "SELECT CNID,parentCN,amendmentReason FROM `contractnotice` WHERE $query = "SELECT CNID,parentCN,amendmentReason FROM `contractnotice` WHERE
parentCN > 0 "; parentCN > 0 ";
$result = mysql_query($query); $result = mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
$result2 = mysql_query("UPDATE contractnotice SET childCN = '" . $result2 = mysql_query("UPDATE contractnotice SET childCN = '" .
$row['CNID'] . "', amendmentReason = '" . $row['CNID'] . "', amendmentReason = '" .
$row['amendmentReason'] . "' where CNID = '" . $row['amendmentReason'] . "' where CNID = '" .
$row['parentCN'] . "';"); $row['parentCN'] . "';");
if ($result2) echo $row['CNID'] . " linked to parent " . $row['parentCN'] . if ($result2) echo $row['CNID'] . " linked to parent " . $row['parentCN'] .
"<br>\n"; "<br>\n";
else "error" . mysql_error(); else "error" . mysql_error();
} }
?> ?>