afhængig af om koden der er i filen slet.php.
Hvis den er så:
<?php
if(isset($nr))
{
mysql_query("delete from bog where nr = $nr");
unset($nr);
}
$db = mysql_connect("localhost","usr","pass");
mysql_select_db("database",$db);
$foresp = mysql_query("SELECT nr, navn, email, ip FROM bog ORDER BY nr DESC");
while($row = mysql_fetch_row($foresp)){
if(is_array($HTTP_GET_VARS)) {
$nr = $row[0];
} elseif (is_array($_GET)) {
$nr = $row[0];
}
echo "<tr><td>$row[0]</td>";
echo "<td align=left>$row[1]</td>";
echo "<td align=left>$row[2]</td>";
echo "<td align=left>$row[3]</td>";
echo "<td align=left><a href=slet.php?nr=$nr>Slet</a></td></tr>";
}
?>
Hvis den ikke er:
<?
$db = mysql_connect("localhost","usr","pass");
mysql_select_db("database",$db);
$foresp = mysql_query("SELECT nr, navn, email, ip FROM bog ORDER BY nr DESC");
while($row = mysql_fetch_row($foresp)){
if(is_array($HTTP_GET_VARS)) {
$nr = $row[0];
} elseif (is_array($_GET)) {
$nr = $row[0];
}
echo "<tr><td>$row[0]</td>";
echo "<td align=left>$row[1]</td>";
echo "<td align=left>$row[2]</td>";
echo "<td align=left>$row[3]</td>";
echo "<td align=left><a href=slet.php?nr=$nr>Slet</a></td></tr>";
}
?>
og i slet.php
<?
mysql_query("delete from bog where nr = $nr");
unset($nr);
?>
-----------------------------------------------------------------------------
Min side ->www.the-hive.dk/~donp/