Depreciate MySQL and GD image graphs
[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); $query = $conn->prepare($query);
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { $query->execute();
$result2 = mysql_query("UPDATE contractnotice SET childCN = '" . if (!$query) {
$row['CNID'] . "', amendmentReason = '" . databaseError($conn->errorInfo());
$row['amendmentReason'] . "' where CNID = '" . }
$row['parentCN'] . "';"); foreach ($query->fetchAll() as $row) {
if ($result2) echo $row['CNID'] . " linked to parent " . $row['parentCN'] . $conn->exec('UPDATE contractnotice SET childCN = "' .
  $row['CNID'] . '", amendmentReason = "' .
  $row['amendmentReason'] . '" where "CNID" = "' .
  $row['parentCN'] . '";');
  $errors = $conn->errorInfo();
   
  if ($errors[1] == 7 || $errors[1] ==0)
  echo $row['CNID'] . " linked to parent " . $row['parentCN'] .
"<br>\n"; "<br>\n";
else "error" . mysql_error(); else print_r($errors);
   
} }
?> ?>