1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <?php include_once ("../lib/common.inc.php"); $query = "SELECT CNID,parentCN,amendmentReason FROM `contractnotice` WHERE parentCN > 0 "; $result = mysql_query($query); while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { $result2 = mysql_query("UPDATE contractnotice SET childCN = '" . $row['CNID'] . "', amendmentReason = '" . $row['amendmentReason'] . "' where CNID = '" . $row['parentCN'] . "';"); if ($result2) echo $row['CNID'] . " linked to parent " . $row['parentCN'] . "<br>\n"; else "error" . mysql_error(); } ?> |