select('id', 'title')->from('lists')->order_by('title'); $response = $mysql->fetch_array(false); foreach ($response as &$r) { $r['title'] = iconv('windows-1251', 'UTF-8', $r['title']); } break; case 'pages' : $mysql->select('id', 'title')->from('pages')->order_by('title'); $response = $mysql->fetch_array(false); foreach ($response as &$r) { $r['title'] = iconv('windows-1251', 'UTF-8', $r['title']); } break; case 'products' : $mysql->select('id', 'title')->from('products')->order_by('title'); $response = $mysql->fetch_array(false); foreach ($response as &$r) { $r['title'] = iconv('windows-1251', 'UTF-8', $r['title']); } break; } if (isset($response)) { header('content-type: application/json; charset=windows-1251'); print $json->encode($response); } ?>