-
☆ A M B ☆
- 24,524 Posts
Your {} tags are mismatched.
yeah thanks spotted that, seems as though the sql is still not giving any results / working when it’s in the plug in?
thanks
Do you mean that there’s no echo?
Change it to:
echo "Output: " . $output;
Then you’ll know if that line is even executing.
You do know that the unlink() won’t execute with the "die;" there, right?
that’s right, no echo is being output, also tried with the new echo but nothing, can’t understand why this would work in a snippet but not plugin?
I guess there would be no benefit this being in an external inc file or call to a snippet..?
thanks
It must be an issue with the array / for each, but as I can’t get any output or errors now I’m not sure what to try next
Sorry, I should have mentioned this earlier, but I’d suggest switching from $modx->db->query() to $modx->db->select(). Query is mainly for internal use by MODx.
http://wiki.modxcms.com/index.php/API:DBAPI:select
Then use something like this after the select statement:
<?php // this is just to get code highlighting - don't paste it.
$count = $modx->db->getRecordCount($result);
if($count) {
die('Successful query: ' . $count . ' Records returned'); // delete this and add your processing code here after you're sure the select is working.
} else {
die('Query failed');
}
If you are hooked to OnBeforeEmptyTrash, the docs should still be there.