我试图删除一个使用PHP的mysql文件这里的代码一旦删除按下没有任何发生任何想法?

Im trying to delete a mysql file using php here is the code once delete is pressed nothing happens any ideas?

delete.php

<?php
  include("db.php");  

    $id =$_REQUEST['PlayerID'];


    // sending query
    mysql_query("DELETE FROM Player WHERE PlayerID = '$id'")
    or die(mysql_error());      

    header("Location: usersOnline.php");
?>

calling it here from separate file

echo"<td><font face = 'Verdana' size = '3' color='black'> <a href ='del.php?Player=$id'><center>Delete</center></a>";

You have ?Player=$id, but your code is looking for $_REQUEST['PlayerID']. Those two terms need to match.


Your code is also vulernable to SQL injection. Look into using parameterized queries with PDO or mysqli.