hey,
(right now I also get the message that I deleted a row, but it doesn't really deletes anything!!!!
this is the function that draws the table in the first place with the link:
function table_dump($table,$id){
$query = "DESCRIBE $table";
$result = mysql_query($query) or print mysql_error();
print "<DIV ALIGN=\"CENTER\">";
print "<table border=1>\n";
print "<td><b>update</td>\n";
print "<td><b>delete</td>\n";
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
print "<td><b>$row[0]</b></td>\n";
}
$query = "SELECT * FROM $table";
$result = mysql_query($query) or print mysql_error();
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
$id = $row["0"];
print "\t<tr>\n";
print "\t\t<td><a href=\"\">update</a></td>\n";
print "\t\t<td><a
href=\"{$_SERVER['PHP_SELF']}"."?delete=3&table=$table&id=$id\">delete</a></td>\n";
foreach ($row as $key){
print "\t\t<td>$key</td>\n";
}
print "\t</tr>\n";
}
print "</table>\n";
print "</DIV>";
}
this is the function which deletes from that table:
function delete_rec($table,$id){
$query = "DELETE FROM $table WHERE id = '$id'";
echo "Record no. $id has been deleted!";
return $query;
}
this is how I call it from another file(the main one):
if(isset($delete)){
delete_rec($table,$id);
}
thanks,s