function getRootNodes($db, $file_id, $iteration, $rootnodes) { $sql = "SELECT context,name,starttime,stoptime,stoptime - starttime AS runtime,HEX(correlator),HEX(parent_correlator),iteration FROM transaction_file T INNER JOIN transaction_types TT ON T.transaction_type = TT.transaction_uid AND TT.file_id = " . $file_id . " AND T.iteration = " . $iteration . " AND HEX(parent_correlator) IS NULL ORDER BY starttime;"; /* create a prepared statement */ if ($stmt = $db->prepare($sql)) { /* execute query */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($t_name, $t_type, $t_start, $t_stop, $t_total, $t_corr, $t_pcorr, $t_iter); /* fetch value */ $stmt->fetch(); //echo $total_iter; while ($stmt->fetch()) { $temp_object = new nodes(); $object = $temp_object->createNode($t_name, $t_type, $t_start, $t_stop, $t_total, $t_corr, $t_pcorr, $t_iter); array_push($rootnodes, $object); } /* close statement */ $stmt->close(); return $rootnodes; } }