Skip to content
Advertisement

Delete a users data from SQL using PHP

Hi im trying to delete a users booking detials when the user clicks delete in my bookingbeforedeltion.php file but for some reason when I test my php file once I click delete it goes to my delete.php screen and says it failed to delete from database and has the error Undefined index: rn. Is my rn not defined? Sorry Im new to this. Here is my code below:

bookingbeforedeltion.php:

delete.php:

Advertisement

Answer

and I think this will help:

  1. As mentioned above, you need to print it from the PHP
  1. Your DELETE is incorrect, the correct one is DELETE FROM ... WHERE ...

EXTRA: 3. You can assign a default value to $roomname

  1. Try to use Prepared-Statement SQL instead of writing it. (I dont know the example, but it can prevent SQL Injection)
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement