f7af9ddfa9
Files correlati : Ricompilazione Demo : [ ] Commento : Prime modifiche git-svn-id: svn://10.65.10.50/trunk@9788 c028cbd2-c16b-5b4b-a496-9718f37d4682
135 lines
2.5 KiB
PHP
Executable File
135 lines
2.5 KiB
PHP
Executable File
|
|
<html>
|
|
<head></head>
|
|
<body>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
class Table
|
|
{
|
|
var $table_array = array();
|
|
var $headers = array();
|
|
var $cols;
|
|
|
|
function table($headers)
|
|
{
|
|
$this->headers = $headers;
|
|
$this->cols = count($headers);
|
|
}
|
|
|
|
function addrow($row)
|
|
{
|
|
if (count($row) != $this->cols)
|
|
return false;
|
|
array_push($this->table_array, $row);
|
|
return true;
|
|
}
|
|
|
|
function output()
|
|
{
|
|
echo "<table align=center border=0>";
|
|
echo "<tr>";
|
|
foreach($this->headers as $headers)
|
|
echo "<th bgcolor=#CCCCCC>$headers</th>";
|
|
echo "</tr>";
|
|
foreach($this->table_array as $y)
|
|
{
|
|
echo "<tr>";
|
|
foreach($y as $xcell)
|
|
if ($xcell != "")
|
|
echo "<td bgcolor=#DDDDDD>$xcell</td>";
|
|
else
|
|
echo "<td><br></td>";
|
|
echo "</tr>";
|
|
}
|
|
echo "</table>";
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
//$tabella = "domande";
|
|
if (!isset($tbl))
|
|
{
|
|
echo "<form action=classe.php><select name=tbl>";
|
|
echo "<option value=corsi>corsi</option>";
|
|
echo "<option value=domande>domande</option>";
|
|
echo "<option value=risposte>risposte</option>";
|
|
echo "<option value=test>test</option>";
|
|
echo "<option value=lezioni>lezioni</option>";
|
|
echo "</select><input type=submit value=Visualizza></form>";
|
|
|
|
}
|
|
|
|
|
|
if (isset($tbl))
|
|
{
|
|
include("required.php");
|
|
|
|
$db = mysql_connect($ip, $user, $password);
|
|
mysql_select_db($dataname,$db);
|
|
$criteri = "SELECT * FROM $tbl ";
|
|
$result = mysql_query($criteri, $db);
|
|
$myrow = mysql_fetch_array($result);
|
|
$dati = array();
|
|
$num_fields = mysql_num_fields($result);
|
|
for($x = 0; $x < $num_fields; $x++)
|
|
$dati[] = mysql_field_name($result, $x);
|
|
$tabella = new table($dati);
|
|
do
|
|
{
|
|
$temp = array();
|
|
foreach($dati as $nome)
|
|
$temp[] = $myrow[$nome];
|
|
$tabella -> addrow($temp);
|
|
}while ($myrow = mysql_fetch_array($result));
|
|
|
|
$tabella -> output();
|
|
}
|
|
|
|
|
|
/*
|
|
|
|
// Scelta del DATABASE
|
|
if (!isset($dbs) && !isset($tbl))
|
|
{
|
|
include("required.php");
|
|
$link = mysql_connect($ip, $user, $password);
|
|
|
|
$db_res = mysql_list_dbs($link);
|
|
$num = mysql_num_rows($db_res);
|
|
for ($x = 0; $x < $num; $x++)
|
|
echo "<a href=classe.php?dbs=".mysql_tablename($db_res, $x).">".mysql_tablename($db_res, $x)."</a><br>";
|
|
mysql_close($link);
|
|
}
|
|
|
|
|
|
// Scelta della TABELLA
|
|
if (isset($dbs))
|
|
{
|
|
echo $dbs;
|
|
include("required.php");
|
|
$link = mysql_connect($ip, $user, $password);
|
|
//$result = mysql_list_tables($dbs, $link);
|
|
$result = mysql_list_tables($dbs);
|
|
$tab_rows = mysql_fetch_row($result);
|
|
for ($x = 0; $x < $tab_rows; $x++)
|
|
{
|
|
//echo "$tab_rows[$x]<br>";
|
|
$table = mysql_tablename($result, $x);
|
|
echo $table;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
*/
|
|
?>
|
|
|
|
</body>
|
|
|
|
</html>
|