Add netbeans project
--- /dev/null
+++ b/.gitignore
@@ -1,1 +1,3 @@
-
+/admin/neo4jimporter/target/
+/admin/neo4jimporter/.settings/
+/nbproject/private/
--- a/about.php
+++ b/about.php
@@ -1,25 +1,24 @@
<?php
-
-
include('./lib/common.inc.php');
include_header("Map");
?>
<div class="msg_list">
-<p class="msg_head">Header-1 </p>
-<div class="msg_body">
-orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
+ <p class="msg_head">Header-1 </p>
+ <div class="msg_body">
+ orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
+ </div>
+ <p class="msg_head">Header-2</p>
+ <div class="msg_body">
+ orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
+ </div>
+ <p class="msg_head">Header-3</p>
+ <div class="msg_body">
+ orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
+ </div>
</div>
-<p class="msg_head">Header-2</p>
-<div class="msg_body">
-orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
-</div>
-<p class="msg_head">Header-3</p>
-<div class="msg_body">
-orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
-</div>
-</div>
-<?php CNDistributionGraph();
+<?php
+CNDistributionGraph();
// select distinct cnid, "publishDate" from (select ("CNID" - MOD("CNID",100)) as cnid from contractnotice where "CNID" < 999999) as a, contractnotice where a.cnid = contractNotice."CNID" order by cnid
?>
@@ -32,32 +31,28 @@
<?php
include_once("./lib/common.inc.php");
$query = 'SELECT DATE("importDate") as importday, count(*) as count, min("publishDate") as start, max("publishDate") as end
-FROM contractnotice WHERE "childCN" = 0 AND "parentCN" = 0 AND DATE("importDate") = (select * from (SELECT DATE("importDate")
+FROM contractnotice WHERE "childCN" is null AND "parentCN" is null AND DATE("importDate") = (select * from (SELECT DATE("importDate")
FROM contractnotice ORDER BY "importDate" DESC limit 1) alias) GROUP BY DATE("importDate")';
$query = $conn->prepare($query);
- $query->execute();
- if (!$query) {
- databaseError($conn->errorInfo());
- }
+$query->execute();
+databaseError($conn->errorInfo());
echo "<div>";
$stats = $query->fetch(PDO::FETCH_ASSOC);
-echo $stats["count"] . " new records in period " . $stats["start"] . " to " . $stats["end"] ."<br>";
+echo $stats["count"] . " new records in period " . $stats["start"] . " to " . $stats["end"] . "<br>";
$query = 'SELECT DATE("importDate") as importday, count(*) as count, min("publishDate") as start, max("publishDate") as end
-FROM contractnotice WHERE ("childCN" != 0 OR "parentCN" != 0) AND DATE("importDate") = (select * from (SELECT DATE("importDate")
+FROM contractnotice WHERE ("childCN" is not null OR "parentCN" is not null) AND DATE("importDate") = (select * from (SELECT DATE("importDate")
FROM contractnotice ORDER BY "importDate" DESC limit 1) alias) GROUP BY DATE("importDate")';
$query = $conn->prepare($query);
- $query->execute();
- if (!$query) {
- databaseError($conn->errorInfo());
- }
+$query->execute();
+databaseError($conn->errorInfo());
echo "<div>";
-$stats = $query->fetch(PDO::FETCH_ASSOC);
-echo $stats["count"] . " updated records in period " . $stats["start"] . " to " . $stats["end"] ."<br>";
+$stats = $query->fetch(PDO::FETCH_ASSOC);
+echo $stats["count"] . " updated records in period " . $stats["start"] . " to " . $stats["end"] . "<br>";
-echo "Last updated: ". $stats["importday"]."<br>";
+echo "Last updated: " . $stats["importday"] . "<br>";
/* Check for null Procurement method and 0 ABN when not ABN exempt */
--- a/admin/fixoldamend.php
+++ b/admin/fixoldamend.php
@@ -1,3 +1,26 @@
<?php
-$query = 'select "CNID" from contractnotice where "CNID" like \'%00_\' and "parentCN" is not null and length("CNID") > 6';
+include_once("../lib/common.inc.php");
+$query = 'update contractnotice set "parentCN" = null where "parentCN" = \'0\'';
+$result = $conn->prepare($query);
+$result->execute();
+$query = 'update contractnotice set "childCN" = null where "childCN" = \'0\'';
+$result = $conn->prepare($query);
+$result->execute();
+$query = 'select "CNID","parentCN" from contractnotice where "CNID" like \'%00_\' and "parentCN" is not null';
+$result = $conn->prepare($query);
+$result->execute();
+foreach ($result->fetchAll() as $record) {
+ $oldCN = $record['CNID'];
+ $parentCN = substr($oldCN,0,-3);
+ if ($parentCN == $record['parentCN']) {
+ $newCN = $parentCN . "-A". substr($oldCN,-1);
+ $updateresult = $conn->exec('UPDATE contractnotice SET "CNID" =
+\'' . $newCN . '\' where "CNID" = \'' . $oldCN . '\';');
+ echo "$oldCN => $newCN (from parent CN $parentCN) <br>\n";
+ }
+ else {
+ echo "parent CN unexpected - $oldCN doesn't look like child of {$record['parentCN']} <br>\n";
+ }
+}
+
--- a/admin/linkAmendments.php
+++ b/admin/linkAmendments.php
@@ -5,9 +5,7 @@
c."parentCN" > 0 AND p."childCN" IS NULL ';
$query = $conn->prepare($query);
$query->execute();
- if (!$query) {
databaseError($conn->errorInfo());
- }
foreach ($query->fetchAll() as $row) {
$conn->exec('UPDATE contractnotice SET "childCN" = \'' .
$row['CNID'] . '\' where "CNID" = \'' .
@@ -36,9 +34,7 @@
GROUP BY "parentCN" having count(*) > 1';
$query = $conn->prepare($query);
$query->execute();
- if (!$query) {
databaseError($conn->errorInfo());
- }
foreach ($query->fetchAll() as $row) {
$cnids = explode(",",str_replace(Array("{","}"),"",$row['array_agg']));
$last_cnid = array_pop($cnids);
--- a/admin/updateReport.php
+++ b/admin/updateReport.php
@@ -1,30 +1,24 @@
<?php
-include_once("../lib/common.inc.php");
-$query = "SELECT DATE(importDate) as importday, count(*) as count, min(publishDate) as start, max(publishDate) as end
-FROM `contractnotice` WHERE childCN = 0 AND parentCN = 0 AND DATE(importDate) in (select * from (SELECT DATE(importDate)
-FROM `contractnotice` ORDER BY `importDate` DESC limit 1) alias)";
-$result = mysql_query($query);
-$stats = mysql_fetch_array($result, MYSQL_BOTH);
-echo $stats["count"] . " new records in period " . $stats["start"] . " to " . $stats["end"] ."<br>";
+include_once('../lib/common.inc.php');
+$query = 'SELECT DATE("importDate") as importday, count(*) as count, min("publishDate") as start, max("publishDate") as end
+FROM contractnotice WHERE "childCN" is null AND "parentCN" is null AND DATE("importDate") in (select * from (SELECT DATE("importDate")
+FROM contractnotice ORDER BY "importDate" DESC limit 1) alias)';
+ $result = $conn->query($query);
+ $stats = $result->fetch();
+echo $stats['count'] . ' new records in period ' . $stats['start'] . ' to ' . $stats['end'] .'<br>';
-$query = "SELECT DATE(importDate) as importday, count(*) as count, min(publishDate) as start, max(publishDate) as end
-FROM `contractnotice` WHERE (childCN != 0 OR parentCN != 0) AND DATE(importDate) in (select * from (SELECT DATE(importDate)
-FROM `contractnotice` ORDER BY `importDate` DESC limit 1) alias)";
-$result = mysql_query($query);
-$stats = mysql_fetch_array($result, MYSQL_BOTH);
-echo $stats["count"] . " updated records in period " . $stats["start"] . " to " . $stats["end"] ."<br>";
+$query = 'SELECT DATE("importDate") as importday, count(*) as count, min("publishDate") as start, max("publishDate") as end
+FROM contractnotice WHERE ("childCN" is not null OR "parentCN" is not null) AND DATE("importDate") in (select * from (SELECT DATE("importDate")
+FROM contractnotice ORDER BY importDate DESC limit 1) alias)';
+ $result = $conn->query($query);
+ $stats = $result->fetch();
+echo $stats['count'] . ' updated records in period ' . $stats['start'] . ' to ' . $stats['end'] .'<br>';
-$query = "SELECT count(*) as count FROM `agency` WHERE `abn` = '0'";
-$result = mysql_query($query);
-$stats = mysql_fetch_array($result, MYSQL_BOTH);
-echo $stats["count"] . " agencies with no ABN<br>";
+$query = 'SELECT count(*) as count FROM agency WHERE abn = \'0\'';
+ $result = $conn->query($query);
+ $stats = $result->fetch();
+echo $stats['count'] . ' agencies with no ABN<br>';
-/*$query = "SELECT count(*) as count FROM `supplierdetails` WHERE `supplierABN` = '0' and supplierCountry LIKE 'Australia'";
-$result = mysql_query($query);
-$stats = mysql_fetch_array($result, MYSQL_BOTH);
-echo $stats["count"] . " Australian suppliers with no ABN<br>";*/
-
-
-echo "Last updated: ". $stats["importdate"]."<br>";
+echo 'Last updated: '. $stats['importdate'].'<br>';
?>
--- a/displayAgency.php
+++ b/displayAgency.php
@@ -1,42 +1,41 @@
<?php
+
include_once ("./lib/common.inc.php");
if ($_REQUEST['agency']) {
-
-include_header("Agency");
- $agency = htmlentities(strip_tags($_REQUEST['agency']));
- MethodCountGraph($agency);
- CnCGraph($agency);
- MethodValueGraph($agency);
- /*biggest contracts
- spending by year
- spending by industry/category
- spending by supplier
-
- spread procurement methods (stacked bar graph)
- + percent consultancies + percent confidential (bar graph)
- Average value by procurement type
-
- --- info
- website, procurement plan, annual reports
- Breakdown of divisions/branches
- Breakdown percentage,number,value by procurement type
- Histograph, overlaying number value reported per week over X years
- Compliance statistics: amendments, delay in reporting average and number completely late*/
-
+ include_header("Agency");
+ $agency = htmlentities(strip_tags($_REQUEST['agency']));
+ MethodCountGraph($agency);
+ CnCGraph($agency);
+ MethodValueGraph($agency);
+ /* biggest contracts
+ spending by year
+ spending by industry/category
+ spending by supplier
+
+ spread procurement methods (stacked bar graph)
+ + percent consultancies + percent confidential (bar graph)
+
+ Average value by procurement type
+
+ --- info
+ website, procurement plan, annual reports
+ Breakdown of divisions/branches
+ Breakdown percentage,number,value by procurement type
+ Histograph, overlaying number value reported per week over X years
+ Compliance statistics: amendments, delay in reporting average and number completely late */
+
$query = 'SELECT "CNID", "description", "value", "agencyName", "category",
"contractStart", "supplierName"
FROM contractnotice
WHERE "agencyName" = :agency
ORDER BY "value" DESC';
-$query = $conn->prepare($query);
-$query->bindParam(":agency", $agency);
- $query->execute();
- if (!$query) {
- databaseError($conn->errorInfo());
- }
+ $query = $conn->prepare($query);
+ $query->bindParam(":agency", $agency);
+ $query->execute();
+ databaseError($conn->errorInfo());
- echo "<table> <thead>
+ echo "<table> <thead>
<tr>
<th>Contract Notice Number</th>
<th>Contract Description</th>
@@ -46,46 +45,44 @@
<th>Supplier</th>
</tr>
</thead>";
- foreach ($query->fetchAll() as $row) {
- setlocale(LC_MONETARY, 'en_US');
- $value = number_format(doubleval($row['value']) , 2);
- echo ("<tr>
+ foreach ($query->fetchAll() as $row) {
+ setlocale(LC_MONETARY, 'en_US');
+ $value = number_format(doubleval($row['value']), 2);
+ echo ("<tr>
<td><a href=\"displayContract.php?CNID={$row['CNID']}\">{$row['CNID']}</a></td>
<td><b>{$row['description']}</b></a></td>
<td>\$$value</td><td>{$row['agencyName']}</td>
<td>{$row['contractStart']}</td>
<td>{$row['supplierName']}</td>
</tr>");
- }
- echo "</table>";
+ }
+ echo "</table>";
} else {
/*
- split by portfolio
- */
-include_header("Agencies");
-agenciesGraph();
- $query = 'SELECT SUM("value"), "agencyName"
+ split by portfolio
+ */
+ include_header("Agencies");
+ agenciesGraph();
+ $query = 'SELECT SUM("value"), "agencyName"
FROM contractnotice
-WHERE "childCN" = 0
+WHERE "childCN" is null
GROUP BY "agencyName" ';
-$query = $conn->prepare($query);
- $query->execute();
- if (!$query) {
- databaseError($conn->errorInfo());
- }
- echo "<table> <thead>
+ $query = $conn->prepare($query);
+ $query->execute();
+ databaseError($conn->errorInfo());
+ echo "<table> <thead>
<tr>
<th>Agency</th>
<th>Total Contracts Value</th>
</tr>
</thead>";
- foreach ($query->fetchAll() as $row) {
- setlocale(LC_MONETARY, 'en_US');
- $value = number_format(doubleval($row[0]) , 2);
- $agency = stripslashes($row[1]);
- echo ("<tr><td><b><a href=\"displayAgency.php?agency={$agency}\">{$agency}</a></b></td><td>\$$value</td></tr>\n");
- }
- echo "</table>";
+ foreach ($query->fetchAll() as $row) {
+ setlocale(LC_MONETARY, 'en_US');
+ $value = number_format(doubleval($row[0]), 2);
+ $agency = stripslashes($row[1]);
+ echo ("<tr><td><b><a href=\"displayAgency.php?agency={$agency}\">{$agency}</a></b></td><td>\$$value</td></tr>\n");
+ }
+ echo "</table>";
}
include_footer();
?>
--- a/displayAmendments.php
+++ b/displayAmendments.php
@@ -1,10 +1,14 @@
<?php
+
include_once ("./lib/common.inc.php");
- include_header("Amendments");
-$query = "select CNID, description, value, pvalue, (value - pvalue) as diff from contractnotice, (SELECT CNID as cn, childCN as ccn, value as pvalue FROM contractnotice where childCN > 0) a".
-" where ".$agencyQ.$yearQ."CNID = ccn AND (value - pvalue) <> 0 order by diff DESC";
-$result = mysql_query($query);
- echo "<table> <thead>
+include_header("Amendments");
+$query = 'select "CNID", description, value, pvalue, (value - pvalue) as diff from contractnotice,
+ (SELECT "CNID" as cn, "childCN" as ccn, value as pvalue FROM contractnotice where "childCN" is not null) a' .
+ ' where ' . $agencyQ . $yearQ . ' "CNID" = ccn AND (value - pvalue) <> 0 order by diff DESC';
+$query = $conn->prepare($query);
+$query->execute();
+databaseError($conn->errorInfo());
+echo "<table> <thead>
<tr>
<th>Contract</th>
<th>Original Value</th>
@@ -12,21 +16,17 @@
<th>Difference</th>
</tr>
</thead>";
-if ($result) {
-while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
- setlocale(LC_MONETARY, 'en_US');
- $value = number_format(doubleval($row['value']) , 2);
- $pvalue = number_format(doubleval($row['pvalue']) , 2);
- $diff = number_format(doubleval($row['diff']) , 2);
- echo ("<tr>");
- echo "<td><A href=\"displayContract.php?CNID={$row['CNID']}\"><b>{$row['description']}</b></a></td>";
- echo "<td>\$$pvalue</td><td>\$$value</td><td>\$$diff</td></tr>";
+foreach ($query->fetchAll() as $row) {
+ setlocale(LC_MONETARY, 'en_US');
+ $value = number_format(doubleval($row['value']), 2);
+ $pvalue = number_format(doubleval($row['pvalue']), 2);
+ $diff = number_format(doubleval($row['diff']), 2);
+ echo ("<tr>");
+ echo "<td><A href=\"displayContract.php?CNID={$row['CNID']}\"><b>{$row['description']}</b></a></td>";
+ echo "<td>\$$pvalue</td><td>\$$value</td><td>\$$diff</td></tr>";
}
-} else {
-echo mysql_error();
-}
+
echo "</table>";
-mysql_free_result($result);
include_footer();
?>
--- a/displayBubbletree.php
+++ b/displayBubbletree.php
@@ -51,7 +51,7 @@
$catthreesresult = $conn->prepare('SELECT substr( "categoryUNSPSC"::text, 0, 4 ) as cat , SUM( "value" ) as value
FROM contractnotice
-WHERE "childCN" = 0 and "categoryUNSPSC" IS NOT NULL
+WHERE "childCN" is null and "categoryUNSPSC" IS NOT NULL
GROUP BY cat order by cat ;');
$catthreesresult->execute();
foreach ($catthreesresult->fetchAll() as $threerow) {
--- a/displayCalendar.php
+++ b/displayCalendar.php
@@ -1,30 +1,29 @@
<?php
+
include_once("./lib/common.inc.php");
include_header("Months and Years");
if ($_REQUEST['month']) {
- echo "<center><h1>".$_REQUEST['month']."</h1></center>";
-$monthParts = explode("-",$_REQUEST['month']);
- $query = 'SELECT "CNID", "description", "value", "agencyName", "category", "contractStart", "supplierName"
+ echo "<center><h1>" . $_REQUEST['month'] . "</h1></center>";
+ $monthParts = explode("-", $_REQUEST['month']);
+ $query = 'SELECT "CNID", "description", "value", "agencyName", "category", "contractStart", "supplierName"
FROM contractnotice
- WHERE "childCN" = 0
+ WHERE "childCN" is null
AND extract(year from "contractStart") = :year
AND extract(month from "contractStart") = :month
ORDER BY value DESC';
-$query = $conn->prepare($query);
-$query->bindParam(":month", $monthParts[0]);
+ $query = $conn->prepare($query);
+ $query->bindParam(":month", $monthParts[0]);
-$query->bindParam(":year", $monthParts[1]);
- $query->execute();
- if (!$query) {
+ $query->bindParam(":year", $monthParts[1]);
+ $query->execute();
databaseError($conn->errorInfo());
- }
-MethodCountGraph($supplier);
-CnCGraph($supplier);
+ MethodCountGraph($supplier);
+ CnCGraph($supplier);
- echo "<table> <thead>
+ echo "<table> <thead>
<tr>
<th>Contract Notice Number</th>
<th>Contract Description</th>
@@ -34,55 +33,51 @@
<th>Supplier</th>
</tr>
</thead>";
- foreach ($query->fetchAll() as $row) {
- setlocale(LC_MONETARY, 'en_US');
- $value = number_format(doubleval($row['value']) , 2);
- echo ("<tr>
+ foreach ($query->fetchAll() as $row) {
+ setlocale(LC_MONETARY, 'en_US');
+ $value = number_format(doubleval($row['value']), 2);
+ echo ("<tr>
<td><a href=\"displayContract.php?CNID={$row['CNID']}\">{$row['CNID']}</a></td>
<td><b>{$row['description']}</b></a></td>
<td>\$$value</td><td>{$row['agencyName']}</td>
<td>{$row['contractStart']}</td>
<td>{$row['supplierName']}</td>
</tr>");
- }
- echo "</table>";
- mysql_free_result($result);
+ }
+ echo "</table>";
} else {
-/*
- split by year
-todo:
-Year/Month drilldown - largest contracts, agencies, suppliers
-count per month
-big picture graphs?*/
+ /*
+ split by year
+ todo:
+ Year/Month drilldown - largest contracts, agencies, suppliers
+ count per month
+ big picture graphs? */
-echo '<img src="graphs/displayContractStartingGraph.php">';
-echo '<img src="graphs/displayContractPublishedGraph.php">';
+ echo '<img src="graphs/displayContractStartingGraph.php">';
+ echo '<img src="graphs/displayContractPublishedGraph.php">';
-$query = 'SELECT extract(year from "contractStart"), extract(month from "contractStart"),
-SUM(value) as val, count(1) as count FROM contractnotice WHERE "childCN" = 0 GROUP BY extract(year from "contractStart"), extract(month from "contractStart") ORDER BY extract(year from "contractStart"), extract(month from "contractStart") ';
-$query = $conn->prepare($query);
- $query->execute();
- if (!$query) {
+ $query = 'SELECT extract(year from "contractStart"), extract(month from "contractStart"),
+SUM(value) as val, count(1) as count FROM contractnotice WHERE "childCN" is null GROUP BY extract(year from "contractStart"), extract(month from "contractStart") ORDER BY extract(year from "contractStart"), extract(month from "contractStart") ';
+ $query = $conn->prepare($query);
+ $query->execute();
databaseError($conn->errorInfo());
- }
- echo "<table> <thead>
+ echo "<table> <thead>
<tr>
<th>Month/Year</th>
<th>Total Contracts Value</th>
<th>Number of Contracts</th>
</tr>
</thead>";
- foreach ($query->fetchAll() as $row) {
-setlocale(LC_MONETARY, 'en_US');
-$value = number_format(doubleval($row["val"]),2);
-$month_name = date( 'F', mktime(0, 0, 0, $row[1]) );
- echo ("<tr><td><b><a href=\"?month=$row[1]-$row[0]\">$month_name {$row[0]}</a></b></td><td>\$$value</td><td>({$row['count']} contracts)</td></tr>");
-}
-echo "</table>";
-mysql_free_result($result);
+ foreach ($query->fetchAll() as $row) {
+ setlocale(LC_MONETARY, 'en_US');
+ $value = number_format(doubleval($row["val"]), 2);
+ $month_name = date('F', mktime(0, 0, 0, $row[1]));
+ echo ("<tr><td><b><a href=\"?month=$row[1]-$row[0]\">$month_name {$row[0]}</a></b></td><td>\$$value</td><td>({$row['count']} contracts)</td></tr>");
+ }
+ echo "</table>";
}
include_footer();
?>
--- a/displayCategory.php
+++ b/displayCategory.php
@@ -3,12 +3,16 @@
if ($_REQUEST['category']) {
include_header("Category");
echo "<center><h1>".$_REQUEST['category']."</h1></center>";
- $query = "SELECT CNID, description, value, agencyName, category, contractStart, supplierName
- FROM `contractnotice`
- WHERE childCN = 0
- AND category = '" . $_REQUEST['category'] . "'
- ORDER BY value DESC";
- $result = mysql_query($query);
+ $query = 'SELECT "CNID", description, value, "agencyName", category, "contractStart", "supplierName"
+ FROM contractnotice
+ WHERE "childCN" is null
+ AND category = :category
+ ORDER BY value DESC';
+$query = $conn->prepare($query);
+$query->bindParam(":category", $_REQUEST['category']);
+ $query->execute();
+ databaseError($conn->errorInfo());
+
echo "<table> <thead>
<tr>
<th>Contract Notice Number</th>
@@ -19,7 +23,7 @@
<th>Supplier</th>
</tr>
</thead>";
- while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
+ foreach ($query->fetchAll() as $row) {
setlocale(LC_MONETARY, 'en_US');
$value = number_format(doubleval($row['value']) , 2);
echo ("<tr>
@@ -31,30 +35,30 @@
</tr>");
}
echo "</table>";
- mysql_free_result($result);
} else {
/*
split by main categories
*/
include_header("Categories");
-$query = "SELECT sum(value), category
-FROM `contractnotice`
-WHERE childCN = 0
-GROUP BY category ORDER BY sum(value) DESC ";
-$result = mysql_query($query);
+$query = 'SELECT sum(value), category
+FROM contractnotice
+WHERE "childCN" is null
+GROUP BY category ORDER BY sum(value) DESC ';
+$query = $conn->prepare($query);
+ $query->execute();
+ databaseError($conn->errorInfo());
echo "<table> <thead>
<tr>
<th>Category</th>
<th>Total Contracts Value</th>
</tr>
</thead>";
-while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
+ foreach ($query->fetchAll() as $row) {
setlocale(LC_MONETARY, 'en_US');
$value = number_format(doubleval($row[0]) , 2);
echo ("<tr><td><A href=\"displayCategory.php?category={$row[1]}\"><b>{$row[1]}</b></a></td><td>\$$value</td></tr>");
}
echo "</table>";
-mysql_free_result($result);
}
include_footer();
?>
--- a/displayConfidentialities.php
+++ b/displayConfidentialities.php
@@ -14,16 +14,17 @@
FROM `contractnotice`
GROUP BY procurementMethod ";
-$result = mysql_query($query);
+ $query = $conn->prepare($query);
+ $query->execute();
+ databaseError($conn->errorInfo());
echo "<table>";
-while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
+ foreach ($query->fetchAll() as $row) {
setlocale(LC_MONETARY, 'en_US');
$value = number_format(doubleval($row[0]),2);
echo ("<tr><td><b>{$row[1]}</b></td><td>\$$value</td></tr>");
}
echo "</table>";
-mysql_free_result($result);
include_footer();
?>
--- a/displayConsultancies.php
+++ b/displayConsultancies.php
@@ -14,16 +14,18 @@
FROM `contractnotice`
GROUP BY procurementMethod ";
-$result = mysql_query($query);
+
+ $query = $conn->prepare($query);
+ $query->execute();
+ databaseError($conn->errorInfo());
echo "<table>";
-while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
+ foreach ($query->fetchAll() as $row) {
setlocale(LC_MONETARY, 'en_US');
$value = number_format(doubleval($row[0]),2);
echo ("<tr><td><b>{$row[1]}</b></td><td>\$$value</td></tr>");
}
echo "</table>";
-mysql_free_result($result);
include_footer();
?>
--- a/displayContract.php
+++ b/displayContract.php
@@ -8,44 +8,40 @@
$query = $conn->prepare($query);
$query->bindParam(":CNID", $_REQUEST['CNID']);
- $query->execute();
- if (!$query) {
- databaseError($conn->errorInfo());
- }
- foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
-setlocale(LC_MONETARY, 'en_US');
-foreach (array_filter($row) as $key => $value) {
- echo "<b>$key</b> ";
-switch ($key) {
-case "supplierName":
-case "supplierABN":
- echo '<a href="displaySupplier.php?supplier='.$row['supplierABN'].'-'.urlencode($row['supplierName']).'">'.$value."</a>";
- break;
-case "agencyName":
- echo '<a href="displayAgency.php?agency='.urlencode($value).'">'.$value."</a>";
- break;
-case "value":
- echo "$".number_format(doubleval($value),2);
- break;
-default:
- echo str_replace(" ","<br>",$value);
+$query->execute();
+databaseError($conn->errorInfo());
+foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
+ setlocale(LC_MONETARY, 'en_US');
+ foreach (array_filter($row) as $key => $value) {
+ echo "<b>$key</b> ";
+ switch ($key) {
+ case "supplierName":
+ case "supplierABN":
+ echo '<a href="displaySupplier.php?supplier=' . $row['supplierABN'] . '-' . urlencode($row['supplierName']) . '">' . $value . "</a>";
+ break;
+ case "agencyName":
+ echo '<a href="displayAgency.php?agency=' . urlencode($value) . '">' . $value . "</a>";
+ break;
+ case "value":
+ echo "$" . number_format(doubleval($value), 2);
+ break;
+ default:
+ echo str_replace(" ", "<br>", $value);
+ }
+ echo "<br>";
+ }
}
-echo "<br>";
-}
-}
-echo '<br><a href="https://www.te