what’s wrong with this? (this code is in a plug-in)
$tbl = $modx->getFullTableName("site_content");
$sql = "SELECT id, parent, contentLang, refId FROM $tbl";
$rs = $modx->dbQuery($sql);
while ($curPage = $modx->fetchRow($rs)) {
if ($curPage['parent'] != 0) {
$sql = "SELECT id, parent, contentLang, refId FROM $tbl WHERE id = ".$curPage['parent'];
$modx->event->alert($sql);
$rs2 = $modx->dbQuery($sql);
if ($parent = $modx->dbQuery($rs2)) {
}
}
}
when it is executed, I get an error:
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« Execution of a query to the database failed - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #24' at line 1 »
SQL: Resource id #24
[Copy SQL to ClipBoard]
Parser timing
MySQL: 0.0011 s s (5 Requests)
PHP: 1136754939.3584 s s
Total: 1136754939.3596 s s
If I copy/paste the query given by the event->alert function in the phpMyAdmin, the query is executed without any error