Vlt hilft ja mein gesamter Code mal...
<?php
$db = pg_connect("host=******* port=**** dbname=***** user=**** password=******");
$query = "SELECT vorname, nachname, straße, hausnummer, plz, ort, vorwahl, telefonnummer, durchwahl, handynummer, id FROM meine_tabelle";
$result = pg_query($query);
echo "<form name=\"files\" action=\"Dbfiles.php\" method=\"post\">";
echo "\t<table border = 2>\n";
echo "\t<th>Vorname</th>\n";
echo "\t<th>Nachname</th>\n";
echo "\t<th>Straße</th>\n";
echo "\t<th>Hausnummer</th>\n";
echo "\t<th>PLZ</th>\n";
echo "\t<th>Ort</th>\n";
echo "\t<th>Vorwahl</th>\n";
echo "\t<th>Telefonnummer</th>\n";
echo "\t<th>Durchwahl</th>\n";
echo "\t<th>Handynummer</th>\n";
while ($line = pg_fetch_array($result, null, PGSQL_BOTH))
{
if (($line[id] % 2) == 0)
{
$hintergrund = " style='background:#D0D0D0'";
}
elseif (($line["id"] % 2) == 1)
{
$hintergrund = " style='background:#808080'";
}
echo "\t<tr$hintergrund id = $line[id]>\n";
echo "\t<td>$line[vorname]</td>\n";
echo "\t<td>$line[nachname]</td>\n";
echo "\t<td>$line[straße]</td>\n";
echo "\t<td>$line[hausnummer]</td>\n";
echo "\t<td>$line[plz]</td>\n";
echo "\t<td>$line[ort]</td>\n";
echo "\t<td>$line[vorwahl]</td>\n";
echo "\t<td>$line[telefonnummer]</td>\n";
echo "\t<td>$line[durchwahl]</td>\n";
echo "\t<td>$line[handynummer]</td>\n";
echo "\t<td><input type=\"Button\" name=\"Bearbeiten\" value=\"Bearbeiten\"></td>\n";
echo "\t<td><input type=\"submit\" name=\"loeschen\" id=\"$line[id]\" value=\"Löschen\"></td>\n";
echo "\t<td>$line[id]</td>\n";
echo "\t<input type=\"hidden\" name=\"id\" value=\"$line[id]\">";
echo "\t</tr>\n";
}
echo "</table>\n";
echo $_POST["id"];
$weg = "DELETE FROM meine_tabelle WHERE id = '$_POST[$id]'";
$result = pg_query($weg);
if ($_POST['loeschen'])
{
$result;
}
echo "</form>\n";
pg_close($db);
?>