QuerySingle('SET character_set_client=latin2'); $db->QuerySingle('SET character_set_results=latin2'); $db->QuerySingle('SET character_set_connection=latin2'); $MIASTA_URL_QUERY=Array(); foreach($CFG['MIASTA_URL'] as $v){ $MIASTA_URL_QUERY[]="miasto.url='$v'"; } $z="SELECT count(*) FROM page INNER JOIN miasto ON page.id_miasto=miasto.id INNER JOIN wojewodztwo ON miasto.id_wojewodztwo=wojewodztwo.id WHERE (".implode(' OR ',$MIASTA_URL_QUERY).") AND page.blokada='N' AND miasto.blokada='N' ORDER BY miasto.url, page.url "; //print $CFG['recs_per_page']; $CFG['records_count']=$db->QuerySingle($z); $CFG['page_count']=ceil($CFG['records_count']/$CFG['recs_per_page']); $CFG['page_current']=abs((int) $_GET['page']); if($CFG['page_current']>$CFG['page_count']-1){$CFG['page_current']=$CFG['page_count']-1;} $CFG['record_start']=$CFG['page_current']* $CFG['recs_per_page']; for($x=0;$x<$CFG['page_count'];$x++){ $CFG['PAGE_ARRAY'][$x]=$x+1; } //print_r($CFG); //echo $db->QuerySingle($z); $z="SELECT page.id as page_id,page.title_".$CFG['current_lang']." as obiekt,page.url as url,miasto.".$CFG['current_lang']." as miasto ,wojewodztwo.".$CFG['current_lang']." as wojewodztwo FROM page INNER JOIN miasto ON page.id_miasto=miasto.id INNER JOIN wojewodztwo ON miasto.id_wojewodztwo=wojewodztwo.id WHERE (".implode(' OR ',$MIASTA_URL_QUERY).") AND page.blokada='N' AND miasto.blokada='N' ORDER BY miasto.url, page.url LIMIT ".$CFG['record_start'].",".$CFG['recs_per_page']." "; //$db->Query2Array($z) $OBJ=Array(); foreach($db->Query2Array($z) as $K=>$V){ $OBJ[$K]=Array(); foreach($V as $k=>$v){ $OBJ[$K][$k]=iconv("ISO-8859-2","UTF-8",$v); } } $smarty->assign('OB',$OBJ); } $smarty->assign('CFG',$CFG); $smarty->display('main_template.tpl'); ?>