$oq['id'], 'name'=>$oq['param3'], 'title'=>$oq['param1'], 'price'=>0, 'default'=>$oq['default'] ); $cquery = mysql_query("SELECT param1, param3, param2, id FROM ".PF."calc_lvl WHERE parent='$oq[id]'"); $dict['countries'][$q[0]]['options'][$oq['id']]['colors']=array(); if($cquery) while($cq=mysql_fetch_row($cquery)) { if($cq[2]=='color') { $dict['countries'][$q[0]]['options'][$oq['id']]['colors'][]=array( 'name'=>$cq[1], 'title'=>$cq[0] ); } else { $rquery = mysql_query("SELECT id, param1, param6, param7 FROM ".PF."calc_lvl WHERE parent='$cq[3]'"); $dict['countries'][$q[0]]['options'][$oq['id']]['prices'] = array(); while($rq = mysql_fetch_row($rquery)) { $dict['countries'][$q[0]]['options'][$oq['id']]['prices'][$rq[1]]['koef'] = $rq[2]; if(mysql_num_rows($pquery = mysql_query("SELECT param3, param7 FROM ".PF."calc_lvl WHERE parent='$rq[0]'"))>0) { while($pq=mysql_fetch_row($pquery)) $dict['countries'][$q[0]]['options'][$oq['id']]['prices'][$rq[1]]['price'][$pq[0]] = $pq[1]; } else $dict['countries'][$q[0]]['options'][$oq['id']]['prices'][$rq[1]]['price'] = $rq[3]; } } } } } elseif($wq['param1']=='установка') { $dict['countries'][$q[0]]['install'] = array(); $iquery = mysql_query("SELECT param1, param7 FROM ".PF."calc_lvl WHERE parent='$wq[id]'"); while($iq=mysql_fetch_row($iquery)) { $dict['countries'][$q[0]]['install'][$iq[0]] = $iq[1]; } } } } //------------------------------------------------------------------ $countries = array('russia'=>'Россия','poland'=>'Польша','italy'=>'Италия','germany'=>'Германия','finland'=>'Финляндия'); $options = array('setka'=>'Москитная сетка','woodcolor'=>'Цвет дерева','oklad'=>'Алюминиевый оклад','furnitura'=>'Фурнитура','otliv'=>'Отливы','podokonnik'=>'Подоконник','otkos'=>'Откосы','zhaluzi'=>'Жалюзи и рулонные шторы','raskladka'=>'Раскладка','tonirovka'=>'Тонированные стекла'); //----------------------------------------------------------------- /*if(mysql_errno()) die('some problems with mysql query...'); $dict=array(); while($q=mysql_fetch_assoc($query)) { $dict[$q['option']][] = iconv('Windows-1251','UTF-8',$q['name']); }*/ mysql_close(); ?> Калькулятор окон (тестовый режим)
Повернуть
$c) { echo '
    '; foreach ($c['options'] as $k => $opt) { echo '
  • '; echo ''.$opt['title'].''; echo ''; foreach($opt['colors'] as $n=>$color) { echo '
  • '; } echo '
'; echo ''; } echo ''; } ?>