* fix the error when parent module doesn't exits.

This commit is contained in:
wangchunsheng
2010-02-19 09:00:29 +00:00
parent d852a210f6
commit 800bfd9f84

View File

@@ -192,6 +192,7 @@ class treeModel extends model
$sql = "SELECT path FROM " . TABLE_MODULE . " WHERE id = '$moduleID'";
$path = $this->dbh->query($sql)->fetchColumn();
$path = substr($path, 1, -1);
if(!$path) return array();
$sql = "SELECT * FROM " . TABLE_MODULE . " WHERE id IN($path) ORDER BY grade";
$parents = $this->dbh->query($sql)->fetchAll();
return $parents;