If you just want to delete from a link, don't care about page reload etc... then it's already answered here:
php delete mysql row from link
But it sounds like you want to click a button, and it'll delete the row without navigating you away from the page you're on, in which case you'll want to look into using some form of ajax.
You've not provided enough of your code so can't help you with updating the display after you've performed your action, but the basis would probably look something like this (untested)
delete.php
<?php
include_once("connect.php");
if ($_GET['mode'] == 'delete') {
$row_id = (int)$_POST['row_id'];
mysql_query("DELETE FROM topics WHERE id=" . $row_id);
}
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1 /jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.delete-row').click(function() {
$.post('delete.php?mode=delete', { row_id: $(this).data('row_id')}).done(function(data) {
// Reload your table/data display
});
});
});
</script>
<button class="delete-row" data-row_id="58">Delete</button>
I would HEAVILY advise against using mysql_ functions, use PDO or MySQLi instead. Go back to basics and learn how PHP and javascript can interact with each other, as there's something not right there in your knowledge.
Edit (additional OCD):
You should also be considering other things, can anyone delete any row? If only certain people should have permission, you should verify that the currently logged in user should be allowed to delete that particular row prior to deleting it.