So far I came up with this code:
function deleteList($deleteList){
foreach ($deleteList as $row)
{
$primaryKey = $row["uid"];
$sql = "DELETE FROM MYTABLE WHERE uid='".$primaryKey."'";
$dsn = 'mysql:host='.DB_HOSTNAME.';dbname='.DB_NAME;
$options = array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
);
$dbh = new PDO($dsn, DB_USERNAME, DB_PASSWORD, $options);
$stmt = $dbh->prepare($sql);
$stmt->execute();
}
return $deleteList;
}
This does not work, the MySQL command does not even get triggered.
Can anybody explain to me, what I am getting wrong?