2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by cwarn23
0

Well first of all, welcome to daniweb. And on future posts can you please use code tags (I know its your first time so I undertand). As for the problem, you will need a second php file just for deleting the mysql entries. First your while loop would look something like this:

while($row = mysql_fetch_array($result))


{
echo "<div class='qwe'>";
echo $row['yazi'];
echo '<br>'
echo '<a href="delete.php?q='.$row['id'].'">Delete</a>'
//$row['id'] is your id field that makes each row unique
//and id may need to be change to the real name
echo "</div>";
}

Then delete.php

<?
mysql_query('DELETE * FROM `table` WHERE `id` = "'.mysql_real_escape_string($_GET['delete']).'"') or die(mysql_error());
//now redirect back
header('Location: http://www.yoursite.com/folder/index.php');
?>

But in that second code box, remember the replace `table` and `id` with the table name and the real column name.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.