Obviously this isnt EXACTLY what you want, but it will give you an amazing head start 😉
note you will need to add the connect statments as this is an include to another db connect file already
.....
$result = mysql_list_tables($dbn);
if (!$result)
{
echo "DB Error, could not list tables\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
while ($row = mysql_fetch_row($result))
{
if ($row[0] == "permissions") { continue; }
if (($table) && ($table != $row[0])) { continue; }
if ($table)
{
echo "<form name=row[0] method=post action=update.php>\n<table width=256 border=1 cellspacing=1 cellpadding=1>\n";
echo "<tr><td colspan=3>Table: $row[0]</td></tr>\n";
$res = mysql_query("SELECT * from $row[0]");
$cols = mysql_fetch_array($res, MYSQL_ASSOC);
while(list($name, $value) = $cols)
{
echo "<tr><td>$name</td>\n<td>";
echo "<input name=$name type=text size=25 value=\"$value\">\n";
echo "</td></tr>\n";
}
echo "</td></tr><input type=hidden name=table value=$row[0]>\n";
echo "<tr><td colspan=2><input type=submit name=action value=insert> <input type=submit name=action value=$ed> <input type=submit name=action value=delete> <input type=submit name=action value=clear> <input type=submit name=action value=back></td>\n";
echo "</form>\n</table><br>\n";
}
else
{
if (!$j)
{
echo "<form name=list method=post action=update.php>\n<table width=256 border=1 cellspacing=1 cellpadding=1>\n<tr><td>Select table to view</td></tr>";
}
echo "<tr><td><input type=submit name=table value=$row[0]></td></tr>";
}
$j=1;
}
if (!$table) { echo "<tr><td><input type=submit name=logout value=logout></td></tr></table></form>"; }
mysql_free_result($result);
?>
basically what this does, is list the tables in a database (ignoring permissions for obvious reasons) and make form submit buttons out of them, then you click on one, and and will list ALL the fields in that table in a table/form layout with text boxes for inputs to them, I'm sure you can see how this is sort of what you want...
hopefully I didnt make any stupid mistakes when I was removing all the uneeded junk I have need of in there 😉
btw, this should also set the text boxes default values to the values from the database