17
i added xoops_ to both table names,
because i get this error
SELECT cid FROM mydownloads_cat WHERE pid=8
Error number: 1146
Error message: Table 'site.mydownloads_cat' doesn't exist
i modified mydownloads_cat to xoops_mydownloads_cat and solved, because i have my tables with the XOOPS prefix.
that´s a detail only
----------------
now the true stuff:
this is the code:
le="color: #000000"><?php include (XOOPS_ROOT_PATH."/class/xoopstree.php"); $xt = new XoopsTree('xoops_mydownloads_cat', "cid", "pid"); $categories = $xt->getAllChildId(8); $categorystring = "("; foreach ($categories as $key => $categoryid) { if ($key != 0) { //Only comma-separate subsequent categories $categorystring .= ", "; } $categorystring .= $categoryid; } $categorystring = ")"; $result = $xoopsDB->query("SELECT lid, cid, title, date, hits FROM 'xoops_mydownloads_downloads' WHERE cid IN ".$categorystring." ORDER BY ".$options[0]." DESC", $options[1], 0);
and this is the MySQL debug:
le="color: #000000"><?php SELECT lid, cid, title, date, hits FROM 'xoops_mydownloads_downloads' WHERE cid IN ) ORDER BY date DESC LIMIT 0, 10 Error number: 1064 Error message: You have an error in your SQL syntax near ''xoops_mydownloads_downloads' WHERE cid IN ) ORDER BY date DESC LIMIT 0, 10' at line 1