这是我的表
我正在尝试将所有ID归入主要类别。这是完美的,但它是正确的做法
FROM category WHERE (lft >= '$left') AND (rgt <='$right')
$allcat_ids = array();
$cat_id = mysql_real_escape_string($_GET['cat_id']);
$res = mysql_query("SELECT lft, rgt FROM category WHERE cat_id = '$cat_id'");
while ($category = mysql_fetch_assoc($res))
{
$left = $category['lft'];
$right = $category['rgt'];
}
$res = mysql_query("SELECT cat_id, lft, rgt FROM category WHERE (lft >= '$left') AND (rgt <='$right')");`
while ($category = mysql_fetch_object($res))
{
$allcat_ids[] = $category->cat_id;
}