$sSql = "SELECT cat_id, cat_id2, cat_name";
$sSql .=" FROM cats WHERE cat_id2='' and locked=0 ORDER BY cat_id ASC";
$result = openDb($sSql);
$recCount = mysql_affected_rows();
if ($result){
$arrData = array();
while ($rows = mysql_fetch_array($result)) {$arrData[] = $rows;}
}else{
return false;
die();
}
for($i=0; $i<$recCount; $i++){
$cat_id=$arrData[$i][0];
$sSql3 = "SELECT cat_id, cat_id2, cat_name";
$sSql3 .=" FROM cats WHERE cat_id2='$cat_id' and locked=0 ORDER BY cat_id ASC";
$result3 = openDb($sSql3);
$recCount3 = mysql_affected_rows();
if($recCount3==0){
?>
}else{
$cat_id=$arrData[$i][0];
$sSql2 = "SELECT cat_id, cat_id2, cat_name";
$sSql2 .=" FROM cats WHERE cat_id2='$cat_id' and locked=0 ORDER BY cat_id ASC";
$result2 = openDb($sSql2);
$recCount2 = mysql_affected_rows();
if ($result2){
$arrData2 = array();
while ($rows2 = mysql_fetch_array($result2)) {$arrData2[] = $rows2;}
}else{
return false;
die();
}
?>
} ?>
} ?>