I have the following loop, which creates a list from a database:
for ($i=0;$i<count($tutor_subj);$i++){
$query_tutors = "SELECT level, subject FROM level, subject WHERE level.id = '$tutor_lvl[$i]' AND subject.id = '$tutor_subj[$i]'";
$result_t = mysqli_query($db_conx, $query_tutors);
while($m = mysqli_fetch_array($result_t)){
echo $m['level']." ".$m['subject']." ".$tutor_top[$i]."<div style='float:right; padding-right:5px;'><a href='#'><img src='images/remove_btn.png' onclick='removeSubj'></a></div></br>";
}
}
?>
As you can see I'm adding a 'remove' button in the html after each entry, and I want to use this button to allow the users to delete that particular row of data from the database if they choose.
My question is how can I link the row from this while loop to the button being generated at the end of each line (so that the appropriate entry is deleted in the DB)?
PS - I havent written the javascript/jquery function removeSubj yet because I'm stuck, hence am not including that