Quantcast
Channel: User andrewsi - Stack Overflow
Viewing all articles
Browse latest Browse all 51

Answer by andrewsi for Deleting a selected record in an HTML form with a checkbox

$
0
0
$st=$object->prepare("delete * from banners where bannerid IN (?)");
$st->bindParam(1, $ids);

You're trying to bind a single parameter to an array of values. You need to pass in each value as a separate parameter; for example:

$st=$object->prepare("delete * from banners where bannerid IN (?,?,?)");

You need to include a placeholder for each value you want to include in your IN clause. You can generate the SQL dynamically, based on how many items are in $ids.

I missed the 'DELETE *', which is invalid syntax; but I'm leaving this in place because the point I did notice is valid. This is an incomplete answer, not a wrong one.


Viewing all articles
Browse latest Browse all 51

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>