php - DELETE multiple rows in PDO -


i'm rookie in pdo , i've done search issue i'm facing , wasn't able find answers it. can see below, have function:

function deleteinfo($id){     $pdo = connpdo();     $deleteinfo = $pdo -> prepare("delete game_locais_zumbis id_zumbi in (:id)");     $deleteinfo -> bindvalue(":id", $id, pdo::param_str);     $deleteinfo -> execute();     $pdo = null; } 

after that, have following code:

while($row = $listinfo -> fetch(pdo::fetch_assoc)){     $ids[] = $row['ids']; } $ids = implode(',', $ids); deleteinfo($ids); 

when echo $ids, get:

1,2,3,4,5

but delete function not deleting 5 rows in db first one, "1". when run same delete function in db, replacing ":id" "1,2,3,4,5", work! know what's mistake here? appreciate help.

i this:

$query = "delete game_locais_zumbis id_zumbi in (".str_repeat("?,", count($ids) - 1)."?)"; $stmt = $conn->prepare($query); $stmt->execute($ids); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -