<?php
mysql_connect("localhost","username","password") or die ("Cannot connect" . mysql_error());
$dbname=$_GET;
$tablname=$_GET;
?>
<div id="stylized" class="myform">
<?php
echo "<span class='db'>Table:" . $tablname . "</span>";
?>
<?php
mysql_select_db($dbname);
$q=mysql_query("SELECT * FROM $tablname");
if(!$q){
die("Query Failed!");
}
$fields_num=mysql_num_fields($q);
echo "<table><tr>";
for($j=0;j<$fields_num;$j++){
$fields=mysql_fetch_field($q);
echo "<th>{$field->name}</th>";
}
echo "</tr>\n";
while($row=mysql_fetch_array($q)){
echo "<tr>";
foreach($row as $cell){
echo "<td>$cell</td>";
echo "</tr>\n";
}
}
mysql_free_result($q);
?>