// // Server Name from calling form $servername = "localhost"; // // Database Name from calling form $db_name = "monmon; // // username to use $username = "readonly"; // password to use $password = "readonly"; // Create connection $conn = new mysqli($servername, $username, $password, $db_name); // Check connection and play the result if ( ! $conn ) { die("Connection failed: " . $mysqli_error()); } // build the SQL to perform the select //$sql = "SELECT Count(DISTINCT `id_evento`) as id_event_count, id_evento ,count(`event_type`) as event_type_count, event_type, `source`, `timestamp` FROM `tevento` GROUP BY `event_type`"; //SELECT * , AVG(p_event_count) as a FROM `p_stats` WHERE `p_event_type` = 'going_unknown' //SELECT * , AVG(p_event_count) as a FROM `p_stats` GROUP BY `p_event_type` //SELECT * , AVG(p_event_count) as a FROM `p_stats` GROUP BY `p_source_server`, `p_event_type` //SELECT * , AVG(p_event_count) AS a, MAX(p_event_count)AS b, MIN(p_event_count) AS c FROM `p_stats` GROUP BY `p_event_type` //SELECT `p_source_server`,`p_event_timestamp`, MIN(p_event_timestamp) AS a, MAX(p_event_timestamp) AS b FROM `p_stats` GROUP BY `p_source_server` //SELECT `p_source_server`,`p_event_type`,`p_event_timestamp`, MIN(p_event_timestamp) AS a, MAX(p_event_timestamp) AS b FROM `p_stats` GROUP BY `p_source_server`, `p_event_type` //SELECT `p_source_server`,`p_event_type`, SUM(p_event_count) AS p_e_count, MIN(p_event_timestamp) AS p_e_first, MAX(p_event_timestamp) AS p_e_last FROM `p_stats` GROUP BY `p_source_server`, `p_event_type` //SELECT p_event_id, p_event_type, p_event_count FROM p_stats ORDER BY `p_event_id` ASC, p_event_type ASC //SELECT p_event_type, p_event_count FROM p_stats GROUP BY p_event_type ASC //SELECT p_event_type, p_event_count,AVG(p_event_count) AS a, MAX(p_event_count)AS b, MIN(p_event_count) AS c FROM p_stats GROUP BY p_event_type ASC //SELECT COUNT(DISTINCT p_event_type),p_event_type, p_event_count, count(p_event_count) AS occurrence, MIN(p_event_timestamp) AS a, MAX(p_event_timestamp) AS b FROM p_stats GROUP BY p_event_type sql$ = "SELECT COUNT(DISTINCT p_event_type),p_event_type, p_event_count, count(p_event_count) AS occurrence, MIN(p_event_timestamp) AS a, MAX(p_event_timestamp) AS b FROM p_stats GROUP BY p_event_type";" //test for result $result = mysqli_query($conn, $sql); // // if you have results do the following if (mysqli_num_rows($result) > 0) { // //// do page top // // // this routine displays the Distinct Rows and their counts for a Pandora DB // // init a counter to top of page // $pagectr = 0; // output data of each row while($row = $result->fetch_assoc()) { // Do the table header if you are starting a page if ($pagectr == 0){ // Recovery description display echo ''; echo ''; echo ''; echo ''; echo '

Ststistics for Pandora Metadata from: ' . $servername . " Database Name: " . $db_name . ' Table Name: p_stat

'; // Headers for table echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ""; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; // do the data rows echo ''; echo '"; echo '"; echo '"; echo '"; echo '"; echo '"; echo ""; $pagectr++; } else { // do only the data rows echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '"; echo '"; echo '"; echo '"; echo '"; echo '"; echo ""; } // if ($pagectr == 0) } // end while($row = $result->fetch_assoc()) } else { echo '
Event TypeEvent IDEvent Type Total CountEvent Type Average CountEvent Type Highest CountEvent Type Lowest CountEvent Type Begin DateEvent Type End Date

' . $row["id_event_count"] . "

' . $row["id_evento"] . "

' . $row["event_type_count"] . "

' . $row["event_type"] . "

' . $row["source"] . "

' . $row["timestamp"] . "

' . $row["id_event_count"] . "

' . $row["id_evento"] . "

' . $row["event_type_count"] . "

' . $row["event_type"] . "

' . $row["source"] . "

' . $row["timestamp"] . "

'; echo ''; echo ''; echo ''; echo '

No Records Match For: Server: ' . $servername . " Database Name: " . $db_name . '

'; } // while($row = mysqli_fetch_assoc($result)) // clear the connection mysqli_close($conn); ?>