* fill test 3 arrays **/ $sql_query = 'SELECT * FROM test_3_50_queries'; $re = query_the_database($sql_query, $con); for ($i = 0; $i < 50; $i++) { $result[] = mysql_fetch_row($re); $test_3_precison[] = $result[$i][2]; $test_3_average_precison[] = $result[$i][3]; $test_3_precison_at_n[] = $result[$i][4]; } $result = array(); /** * fill test 4 arrays **/ $sql_query = 'SELECT * FROM test_4_50_queries'; $re = query_the_database($sql_query, $con); for ($i = 0; $i < 50; $i++) { $result[] = mysql_fetch_row($re); $test_4_precison[] = $result[$i][2]; $test_4_average_precison[] = $result[$i][3]; $test_4_precison_at_n[] = $result[$i][4]; } function print_chart($first_line_array, $second_line_array, $y_axis_name, $title_name) { // content="text/plain; charset=utf-8" require_once 'jpgraph/jpgraph.php'; require_once 'jpgraph/jpgraph_line.php'; // Create the graph. These two calls are always required $graph = new Graph(1000, 300); $graph->SetScale('textlin'); // Create the linear plot
function print_divs($table_name, $colour) { echo ' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Print_divs</title> <link rel="stylesheet" href="colourcss.css" type="text/css" media="screen" charset="utf-8"> </head> <body>'; $test_1_record = array(); $con = mysql_connect("localhost", "dandysea", "fake password"); /*$con = mysql_connect("localhost","root","");*/ if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db('dandysea_evaluation_results', $con); /*mysql_select_db('evaluation_results', $con);*/ if (!$con) { die('Can\'t use evaluation_results : ' . mysql_error()); } /** * fill test 1 arrays **/ $sql_query = "SELECT * FROM {$table_name}"; $re = query_the_database($sql_query, $con); for ($i = 0; $i < 50; $i++) { $result[] = mysql_fetch_row($re); /*$test_1_precison[] = $result[$i][2];*/ /*$test_1_average_precison[] = $result[$i][3];*/ /*$test_1_precison_at_n[] = $result[$i][4];*/ } /*print_r ($result);*/ for ($i = 0; $i < 50; $i++) { echo '<div class = "one_query"> '; for ($j = 0; $j < 150; $j++) { if ($result[$i][$j] == 0) { echo '<div class="zero"> </div>'; } if ($result[$i][$j] == 1) { if ($colour === 1) { echo '<div class="one_red"> </div>'; } if ($colour === 2) { echo '<div class="one_blue"> </div>'; } /*echo ('hello');*/ } if ($result[$i][$j] == -1) { echo '<div class="minus_one"> </div>'; } } echo '</div>'; } echo ' </body> </html>'; $result = array(); }