I am a bit stuck and also new in this topic. I want to delete certain elements in a SQL table. The entries to delete are stored in an array. Usually its done with the commaned DELETE FROM table where id in (1,2,3,4);
. But as soon as I insert my array I receive the error "Array to string conversion". I am bit lost as I do not use any strings.
Thats my delete statement, please ignore SQL injection for now.
$checkIndexes = $_POST['checkIndexes'];
print_r($checkIndexes);
$deleteProperty = "
BEGIN TRANSACTION [deleteProperty]
BEGIN TRY
DELETE FROM eigenschaften WHERE id IN ('$checkIndexes');
COMMIT TRANSACTION [deleteProperty];
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION [deleteProperty]
END CATCH
";
if (!sqlsrv_query($connection, $deleteProperty)) {
die (print_r(sqlsrv_errors(), true));
}