Come posso ciclare piu query senza che vadano in conflitto tra loro ??? Ho riportato il codice che utilizzo ma ovviamente e sbagliato...
PHP:
function option_category_id(){
global $html;
$html = '';
DB::select( '*', 'terms', 'parent="0"' );
if( DB::$result && DB::num() > 0 ){
while ( $obj = DB::obj() ) {
$id = $obj->ID;
$name = $obj->name;
$html .= '<option value="'.$id.'">'.$name.'</option>';
option_each_category_id( $id );
}
}
return $html;
}
function option_each_category_id( $id ){
global $html, $level;
if( ! isset( $level ) )
$level = '- ';
else
$level .= '- ';
DB::select( '*', 'terms', 'parent="'.$id.'"' );
if( DB::$result && DB::num() > 0 ){
while ( $obj = DB::obj() ) {
$ID = $obj->ID;
$name = $obj->name;
$html .= '<option value="'.$ID.'">'.$level.$name.'</option>';
option_each_category_id( $ID );
}
}
}