Delete PHP Record

Asked

Viewed 25 times

-1

Good morning, I need to delete a record and 2. Ex. I want to delete the record with ID 1 and the next 2 (2 and 3), how do I do this?

I have only Cod to exclude the main (1)

$stmt = $PDO->prepare("DELETE FROM banco WHERE id = :id");
$stmt->bindParam(':id', $id, PDO::PARAM_INT);

if ($stmt->execute()):              
    header("Location: home.php");
else:
    echo "Erro ao remover";
    print_r($stmt->errorInfo());
endif;

I don’t know how to do it... thank you

  • id = :id, change this condition in the query.

  • using a while?

  • id IN (1, 2, 3)

  • but when the main one is ex. id 232 to get the id’s 233 and 234

  • Ué, only generate values with PHP and leave dynamic...

  • that’s the question... how to do?

  • $id+1, $id+2 and so on...

  • I will test and return you

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.