Often, I find myself re-using code over and over. I thought I would share some really really … poor code with you. However, it gives you an example of ONE way that does work.
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = 'itemlist.php';
$qs = $_SERVER["QUERY_STRING"];
$qs_array = explode("&",$qs);
$db = "inventory";
if (isset($_GET["p"])) { $p = $_GET["p"] ;} else { $p = "1";}
if (isset($_GET["id"])) $id = $_GET["id"];
if (isset($_GET["a"])) { $action = $_GET["a"];} else { $action = "n";}
if (isset($_GET["table"])) {$tbl = $_GET["table"];} else { $tbl = "character";}
if (isset($_GET["idcol"])) { $idcol = $_GET["idcol"];} else { $idcol = "char_id";}
$pre_where = "";
$post_where = "";
if (isset($id)) {
$pre_where = " WHERE " . $idcol . " = " . $id;
$post_where = " WHERE " . $idcol . " = " . $id;
} else {
$pre_where = " WHERE 0 = 1";
$post_where = " WHERE 0 = 1";
}
setlocale(LC_MONETARY, 'en_US');
// Connecting, selecting database
$dbconn = pg_connect("host=localhost dbname=$db user=username password=password")
or die('Could not connect: ' . pg_last_error());
$query = "select tablename from pg_tables where tableowner='username' order by tablename";
$result = pg_query($query) or die('Query failed: ' . pg_last_error());
?>
<a href="index.php">back</a>
<table border="1">
<?
while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
?>
<tr>
<td><? echo $line['tablename']; ?></td>
<td><a href="list.php?table=<? echo trim($line['tablename']); ?>">list</a></td>
</tr>
<?
}
?>
</table>
</html>
<html>
<title>Table List</title>
<?php
*** updated *** this one uses PostgreSQL not mySQL.

[...] This post was mentioned on Twitter by Jonathan Day, Jonathan Day. Jonathan Day said: @Eric_Allison http://bit.ly/9MNVj0 Here's and example of my php style. Notice the in-line php. [...]
yeah my dad will like this