]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/scripts/public_html/common.php
the web interface for the benchmarking system
[helm.git] / helm / matita / scripts / public_html / common.php
1 <?php
2
3 function query($q) {
4   $db = mysql_pconnect("localhost","helm");
5   mysql_select_db("matita");
6   $rc = mysql_query($q,$db);
7   if(!$rc) {
8     die("Query failed: " . mysql_error());
9   }
10   $result = array();
11   while( $row = mysql_fetch_array($rc, MYSQL_ASSOC)){
12     $result[] = $row;
13   }
14   mysql_free_result($rc);
15   mysql_close($db);
16
17   return $result;
18 }
19   
20 function array_to_combo($l,$a) {
21   echo "<select name=\"$l\">";
22   echo "<option value=\"--\">--</option>";
23   foreach ($a as $k => $v) {
24     foreach( array_keys($v) as $k1 => $i) {
25       echo "<option value=\"{$v[$i]}\">{$v[$i]}</option>";
26     }
27   }
28   echo "</select>";
29 }
30
31 ?>