0

This code is telling me that the $id variable is undefined. I already initialized it as a superglobal in the code but its still saying that its not initialized

 $id = $_POST['ID];

 $dbc =  mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
        $query = "DELETE FROM guitar_wars WHERE id = $id LIMIT 1";
        mysqli_query($dbc, $query);
        mysqli_close($dbc);

Why is it telling me that the id variable is undefined? Thanks for all the help in advance.

Mekanic
  • 137
  • 2
  • 10
  • `$id = $_POST['ID'];` try this – er.irfankhan11 Sep 07 '15 at 05:59
  • @Irfan That would fix the syntax error in the post, but not an undefined variable error. I'm assuming there was a mistake when pasting the code here. – Mike Sep 07 '15 at 06:00
  • Hey Irfan. Thanks for your help. The code still didnt work but I'm working on it. The problem with the code is elsewhere. – Mekanic Sep 10 '15 at 04:44
  • $query = "DELETE FROM guitar_wars WHERE id = $id LIMIT 1"; Is there something wrong with this code? – Mekanic Sep 10 '15 at 04:48

0 Answers0