while ($row = $set1Result->fetch_assoc()) { $set1[] = $row['effect']; } for ($j = 1; $j <= $numProbes; $j++) { $set2 = array(); $set2Query = "SELECT effect FROM individualEffect_MEM WHERE probeID = {$j} ORDER BY individualID"; $set2Result = $mysqli->query($set2Query); if ($set2Result == null) { echo "Query failed near line " . __LINE__ . ": {$set2Query}"; echo "<br />Error is " . $mysqli->error; exit; } while ($row = $set2Result->fetch_assoc()) { $set2[] = $row['effect']; } $correlation = $correlationEngine->Correlation($set1, $set2); // $knownCorrelationQuery = "SELECT correlation FROM staticCorrelation WHERE probe1ID = $i AND probe2ID = $j;"; // $knownCorrelationResult = $mysqli->query($knownCorrelationQuery); // if ($knownCorrelationResult == null) // { // echo "Query failed near line ".__LINE__ .": $knownCorrelationQuery"; // echo "<br />Error is ".$mysqli->error; // exit(); // } // if ($row = $knownCorrelationResult->fetch_assoc()) // { // $correlation = $row['correlation']; // } // $correlationEngine->Correlation($set1, $set2, correlation); // echo "<pre>"; print_r($set1); echo "</pre>\n<pre>"; print_r($set2); echo "</pre>\n<pre>"; print_r($correlationEngine); echo "</pre>\ncorrelation is $correlation"; die(); if ($i == $j) {
$updateCorrelationQuery = "UPDATE staticCorrelationTest SET correlation = 1 WHERE probe1ID = " . $probes[$i]['ID'] . " AND probe2ID = " . $probes[$i]['ID'] . ";"; $updateResult = $mysqli->query($updateCorrelationQuery); if ($updateResult == null || $mysqli->error) { echo "Query failed near line " . __LINE__ . ": {$updateCorrelationQuery}"; echo "<br />Error is " . $mysqli->error; exit; } for ($j = $i + 1; $j < $numProbes; $j++) { $set2 = array(); $set2Query = "SELECT effect FROM individualEffect WHERE probeID = " . $probes[$j]['ID'] . " ORDER BY individualID"; $set2Result = $mysqli->query($set2Query); if ($set2Result == null) { echo "Query failed near line " . __LINE__ . ": {$set2Query}"; echo "<br />Error is " . $mysqli->error; exit; } while ($row = $set2Result->fetch_assoc()) { $set2[] = $row['effect']; } $correlation = $correlationEngine->Correlation($set1, $set2, $probes[$i]['indMean'], $probes[$j]['indMean'], $probes[$i]['indSSMeanDevn'], $probes[$j]['indSSMeanDevn']); // echo "<pre>"; print_r($set1); echo "</pre>\n<pre>"; print_r($set2); echo "</pre>\ncorrelation is $correlation"; die(); $updateCorrelationQuery = "UPDATE staticCorrelationTest SET correlation = {$correlation}\n\t\t\t\tWHERE probe1ID = " . $probes[$i]['ID'] . " AND probe2ID = " . $probes[$j]['ID'] . " OR probe1ID = " . $probes[$j]['ID'] . " AND probe2ID = " . $probes[$i]['ID'] . ";"; $updateResult = $mysqli->query($updateCorrelationQuery); if ($updateResult == null || $mysqli->error) { echo "Query failed near line " . __LINE__ . ": {$updateCorrelationQuery}"; echo "<br />Error is " . $mysqli->error; exit; } } } echo " --- finished ---\n";