- Impact
- 11
When i click on Delete, it will delete the row from the mysql, but it will change all the ids to the same (as the one i deleted) and the row i deleted still shows up. I would need to refresh the page to change the ids back to their original ones and to have the row i deleted to dissapear. How can i do this without pressing the refresh button?
The code is:
Edit: i just fixed it so they dont all change to the same id (changed the $id in the isset to $tid) But how can i automaticaly refresh it?
Edit: i got it to work.
The code is:
Code:
while ($row = mysql_fetch_array($rs))
{
$title = $row["title"];
$url = $row["url"];
$id = $row["id"];
$category = $row["category"];
$description = $row["description"];
if(isset($_GET["delete"])) {
$id = $_GET["delete"];
mysql_query("DELETE FROM tutorials WHERE id='$id' LIMIT 1");
}
echo("<tr><td>$id</td><td>$title</td><td>$category</td><td>$description</td><td>Edit | <a href=\"tutorials.php?delete=$id\">Delete</a></td></tr>");
}
Edit: i just fixed it so they dont all change to the same id (changed the $id in the isset to $tid) But how can i automaticaly refresh it?
Edit: i got it to work.
Last edited:







