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 "";
echo "";
foreach($this->headers as $headers)
echo "$headers | ";
echo "
";
foreach($this->table_array as $y)
{
echo "";
foreach($y as $xcell)
if ($xcell != "")
echo "$xcell | ";
else
echo "
| ";
echo "
";
}
echo "
";
}
}
//$tabella = "domande";
if (!isset($tbl))
{
echo "";
}
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 "".mysql_tablename($db_res, $x)."
";
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]
";
$table = mysql_tablename($result, $x);
echo $table;
}
}
*/
?>