Hello
What I'd like to do is, that when a user presses the "delete" button when deleting a friend, it would delete that friend from the database.
Current problems:
- fetching the username from the friend to delete
- deleting the friend (I'm still a beginner at AJAX)
should I use a href or a submit button? this is what I have (using a submit button, but I have no idea on how to fetch the specific friends username which needs to be deleted)
PHP Code:
while($row2 = mysql_fetch_array($qwery))
{
$friend = $row2['user_username'];
$pic = mysql_query("SELECT * FROM users WHERE username='$friend'");
$picrow = mysql_fetch_assoc($pic);
echo "<img src='".$picrow['imagelocation']."' width='10%'>"."<br />"."<a href='viewbuddy.php?username=".$row2['user_username']."&page=profile'>".$row2['user_username']."</a>"."<br />"."<input type='submit' value='delete' onclick='deleteBud();'>"."<p />";
}
This echoes the friends and a submit button saying "delete".
what should I do to delete them? do I need a seperate file, like delete.php or something?
have a nice day