How do I use a variable in DELETE FROM subscribe WHERE statement?

Avatar
  • updated
  • Answered

How do I use a variable in DELETE FROM subscribe WHERE statement?

$sql = "INSERT INTO subscribe (email) VALUES ('$email')"; works.

$sql = DELETE FROM subscribe WHERE email = $email;  errors out.

I tried SET @email = $email;

Then $sql = DELETE FROM subscribe WHERE email = @email;

Parse error: syntax error, unexpected '@' in /home/birdbr7/public_html/scripts/welp.php on line 49

Robert

Pinned replies
Avatar
Josh Green
  • Answer
  • Answered

Hello Robert, unfortunately, while our support is limited in this area, I have found some information that may assist at https://stackoverflow.com/questions/61818093/delete-from-variable-name

Avatar
Josh Green
  • Answer
  • Answered

Hello Robert, unfortunately, while our support is limited in this area, I have found some information that may assist at https://stackoverflow.com/questions/61818093/delete-from-variable-name