I have an array of GUIDs:
Array
(
[0] => 1770302746_580821208_2068022554_1652435499
[1] => 595039408_884272175_1344680100_1997277231
...
)
which I implode to a comma serparated string*:
1770302746_580821208_2068022554_1652435499,595039408_884272175_1344680100_1997277231
that I then pass to a sql DELETE statement:
$q=$conn->prepare(" DELETE FROM su_posts_att_sort WHERE FileGUID IN ({$GUIDs}) ");
$q->execute();
No rows are deleted however. Placing try / catch blocks to return any exception has not thrown any. Can anyone let me know where I'm going wrong?
*Have also tried with each GUID enclosed in double quotes.
EDIT Here is the submitted sql:
DELETE FROM su_posts_att_sort WHERE FileGUID IN ('1770302746_580821208_2068022554_1652435499','595039408_884272175_1344680100_1997277231')
Works fine through the console...
1770302746and595039408, ignoring the rest as garbage.$GUIDs = "\'".implode("\',\'", $_POST['arrDeleted'])."\'";