More MySQL purging
[contractdashboard.git] / heuristics / runHeuristics.php
blob:a/heuristics/runHeuristics.php -> blob:b/heuristics/runHeuristics.php
--- a/heuristics/runHeuristics.php
+++ b/heuristics/runHeuristics.php
@@ -7,9 +7,10 @@
 FROM contractnotice JOIN agency ON contractnotice.agencyName=agency.agencyName
 WHERE  DATE(importDate) = (select * from (SELECT DATE(importDate) 
 FROM contractnotice ORDER BY importDate DESC limit 1) alias)";
-$result = mysql_query($query);
-if (!$result) echo mysql_error().$query;
-while ($cn = mysql_fetch_array($result, MYSQL_BOTH)) {
+    $query = $conn->prepare($query);
+    $query->execute();
+    databaseError($conn->errorInfo());
+foreach ($query->fetchAll() as $cn) {
 	//get each new CN from latest update
 	foreach ($heuristics as $heuristic => $description) {
 		// run all heuristics