<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Форум PHP-MyAdmin.RU &mdash; Помогите начинающему программисту :)]]></title>
		<link>https://forum.php-myadmin.ru/viewtopic.php?id=2272</link>
		<atom:link href="https://forum.php-myadmin.ru/extern.php?action=feed&amp;tid=2272&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «Помогите начинающему программисту :)».]]></description>
		<lastBuildDate>Tue, 02 Aug 2011 11:30:54 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Помогите начинающему программисту :)]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=17126#p17126</link>
			<description><![CDATA[<p>все решил.<br />ВОт ответ</p><div class="codebox"><pre><code>&lt;?php
$var=$search_result[&#039;offers&#039;][0][&#039;locations&#039;][0][&#039;country_name&#039;];
                ?&gt;
                
           
              &lt;/h4&gt;
            &lt;?
                include(&quot;../admin/config/db.conf.php&quot;);
                $link = mysql_pconnect($CONFIG[&#039;DB&#039;][&#039;local&#039;][&#039;mysql&#039;][&#039;host&#039;], $CONFIG[&#039;DB&#039;][&#039;local&#039;][&#039;mysql&#039;][&#039;user&#039;], $CONFIG[&#039;DB&#039;][&#039;local&#039;][&#039;mysql&#039;][&#039;password&#039;]);
                mysql_select_db($CONFIG[&#039;DB&#039;][&#039;local&#039;][&#039;mysql&#039;][&#039;db_name&#039;], $link);
                mysql_query(&quot;SET NAMES utf8&quot;);

                $SQL = &quot;SELECT t.title as title,
t.email as email,
c.name as city_name,
c.city_id as id,
co.CName AS cityname,
co.country_id,
f.countries
     FROM ua_cities c
     LEFT JOIN  tourfirm_offices t ON t.city_id = c.city_id
     LEFT JOIN tourfirms f ON t.firm_id = f.firm_id
     LEFT JOIN countries co ON (f.countries LIKE CONCAT( co.country_id, \&quot;,%\&quot; )
     OR f.countries LIKE CONCAT( \&quot;%,\&quot;, co.country_id )
     OR f.countries LIKE CONCAT( \&quot;%,\&quot;, co.country_id, \&quot;,%\&quot; ))
  WHERE t.pay_status = 1
  AND co.CName = \&quot;$var\&quot;
  GROUP BY city_name&quot;;
                $res = mysql_query($SQL);

                $out_city = &quot;&quot;;
                while ($info = mysql_fetch_array($res)) {
                    $city_array[] = $info[&quot;id&quot;];
                    $out_city .= &quot;&lt;option value=&#039;&quot;.$info[&quot;id&quot;].&quot;&#039;&gt;&quot;.( $info[&quot;city_name&quot;]).&quot;&lt;/option&gt;&quot;;
                }



                $SQL = &quot;
SELECT t.title as title,
t.email as email,
c.name as city_name,
c.city_id as id,
co.CName AS cityname,
co.country_id,
f.countries
     FROM ua_cities c
     LEFT JOIN  tourfirm_offices t ON t.city_id = c.city_id
     LEFT JOIN tourfirms f ON t.firm_id = f.firm_id
     LEFT JOIN countries co ON f.countries LIKE CONCAT( co.country_id, \&quot;,%\&quot; )
     OR f.countries LIKE CONCAT( \&quot;%,\&quot;, co.country_id )
     OR f.countries LIKE CONCAT( \&quot;%,\&quot;, co.country_id, \&quot;,%\&quot; )
  WHERE t.pay_status = 1
  AND co.CName = \&quot;$var\&quot;
  GROUP BY t.title&quot;;
$res = mysql_query($SQL);
                while ($info = mysql_fetch_array($res)) {
                    $agancy_array[] = $info;
                }

                             //   if (!$res = mysql_query($SQL)) exit(mysql_error());

                //var_dump($agancy_array);
                //echo iconv(&quot;windows-1251&quot;, &quot;utf-8&quot;, $lang[&#039;country&#039;]);
                //echo ($search_result[&#039;offers&#039;][0][&#039;locations&#039;][0][&#039;country_name&#039;]);
            ?&gt;
                &lt;script&gt;
                      var data = new Array();
                      data[&quot;empty&quot;] = &#039;&lt;select name=&quot;why&quot; style=&quot;width:200px;&quot;&gt;&lt;option&gt;-------&lt;/option&gt;&lt;/select&gt;&#039;;
                      &lt;?
                      foreach ($city_array as $c_key =&gt; $c_value) {

                      ?&gt;
                          data[&quot;&lt;?=$c_value?&gt;&quot;] = &#039;&lt;select name=&quot;why&quot; style=&quot;width:200px;&quot;&gt;&#039;;

                      &lt;?
                        foreach ($agancy_array as $a_key =&gt; $a_value) {
                            if ($a_value[&quot;id&quot;] == $c_value) {
                    ?&gt;
                                data[&quot;&lt;?=$c_value?&gt;&quot;] += &#039;&lt;option value=&quot;&lt;?=$a_value[&quot;email&quot;]?&gt;&quot;&gt;&lt;?=($a_value[&quot;title&quot;])?&gt;&lt;/option&gt;&#039;;
                    &lt;?
                            }
                        }
                    ?&gt;
                        data[&quot;&lt;?=$c_value?&gt;&quot;] += &#039;&lt;/select&gt;&#039;;
                    &lt;?
                    }
                      ?&gt;
                      function changeCity(obj) {
                          document.getElementById(&quot;office&quot;).innerHTML = data[obj.value];
                      }
                  &lt;/script&gt;
           
                  &lt;table cellspacing=&quot;0&quot; class=&quot;tour_general_touriste&quot; border=&quot;0&quot; align=&quot;center&quot;  id=&#039;order_form_table&#039;&gt;
                &lt;tbody&gt;
                  &lt;tr&gt;
                    &lt;td&gt;&lt;label class=&quot;title_strong&quot;&gt;ФИО&lt;span class=&quot;red_star&quot;&gt;*&lt;/span&gt;:&lt;/label&gt;&lt;/td&gt;
                    &lt;td class=&quot;second&quot;&gt;&lt;input tabindex=&quot;1&quot; id=&quot;second_name&quot; name=&quot;fio&quot; value=&quot;&lt;? echo post(&#039;second_name&#039;); ?&gt;&quot; /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                    &lt;td&gt;&lt;label class=&quot;title_strong&quot;&gt;Город&lt;span class=&quot;red_star&quot;&gt;*&lt;/span&gt;:&lt;/label&gt;&lt;/td&gt;
                    &lt;td class=&quot;second&quot;&gt;&lt;input tabindex=&quot;4&quot; name=&quot;city&quot; value=&quot;&lt;? echo post(&#039;city&#039;); ?&gt;&quot; /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                    &lt;td&gt;&lt;label class=&quot;title_strong&quot;&gt;Телефон&lt;span class=&quot;red_star&quot;&gt;*&lt;/span&gt;:&lt;/label&gt;&lt;/td&gt;
                    &lt;td class=&quot;second&quot;&gt;&lt;input tabindex=&quot;5&quot; name=&quot;tel&quot; value=&quot;&lt;? echo post(&#039;phone&#039;); ?&gt;&quot; /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                    &lt;td&gt;&lt;label class=&quot;title_strong&quot;&gt;E-mail:&lt;/label&gt;&lt;/td&gt;
                    &lt;td class=&quot;second&quot;&gt;&lt;input tabindex=&quot;6&quot; name=&quot;email&quot; value=&quot;&lt;? echo post(&#039;email&#039;); ?&gt;&quot; /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                &lt;/tbody&gt;
              &lt;/table&gt;
              &lt;div style=&quot;float:left; padding-top:10px;&quot; align=&quot;center&quot;&gt;
                  Выберете офис:
              &lt;/div&gt;
              &lt;table cellspacing=&quot;0&quot; class=&quot;tour_general_touriste&quot; border=&quot;0&quot; align=&quot;center&quot;  id=&#039;order_form_table&#039;&gt;
                &lt;tbody&gt;
                  &lt;tr&gt;
                    &lt;td&gt;&lt;label class=&quot;title_strong&quot;&gt;Город:&lt;/label&gt;&lt;/td&gt;
                    &lt;td class=&quot;second&quot;&gt;
                        &lt;select style=&quot;width:200px;&quot; onchange=&quot;changeCity(this)&quot;&gt;
                            &lt;option value=&quot;empty&quot;&gt;-------&lt;/option&gt;
                            &lt;?=$out_city?&gt;
                        &lt;/select&gt;
                    &lt;/td&gt;
                  &lt;/tr&gt;
                 &lt;tr&gt;
                    &lt;td&gt;&lt;label class=&quot;title_strong&quot;&gt;Офис:&lt;/label&gt;&lt;/td&gt;
                    &lt;td class=&quot;second&quot;&gt;
                        &lt;div id=&quot;office&quot;&gt;
                            &lt;select name=&quot;why&quot; style=&quot;width:200px;&quot;&gt;
                                &lt;option&gt;-------&lt;/option&gt;
                            &lt;/select&gt;
                        &lt;/div&gt;
                    &lt;/td&gt;
                  &lt;/tr&gt;
                &lt;/tbody&gt;
              &lt;/table&gt;
              &lt;input type=&quot;hidden&quot; name=&quot;tour&quot; value=&quot;&lt;? echo $search_result[&#039;offers&#039;][0][&#039;id&#039;]; ?&gt;&quot; /&gt;
              &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;send&quot;&gt;
              &lt;input type=&quot;hidden&quot; name=&quot;hash&quot; value=&quot;&lt;?=$hash?&gt;&quot;&gt;
              &lt;input type=&quot;hidden&quot; name=&quot;time&quot; value=&quot;&lt;?=$time?&gt;&quot;&gt;
          &lt;/div&gt;</code></pre></div><p>Нужно было поставить<br /></p><div class="codebox"><pre><code> mysql_query(&quot;SET NAMES utf8&quot;); </code></pre></div><p>а так же поубирать </p><div class="codebox"><pre><code>.iconv()</code></pre></div><p> и кодировка не глючит и все ищет супер!<br />Спасибо Вам огромнейшее за уделенное время! Без Вас я бы не справился <img src="https://forum.php-myadmin.ru/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[null@example.com (GrandMasterX)]]></author>
			<pubDate>Tue, 02 Aug 2011 11:30:54 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=17126#p17126</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помогите начинающему программисту :)]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=17112#p17112</link>
			<description><![CDATA[<div class="quotebox"><cite>GrandMasterX сказал:</cite><blockquote><p>У Вас запрос работает?</p></blockquote></div><p>Оба запроса работают совершенно нормально и возвращают данные. Второй вопрос собирает данные в массив $agancy_array после чего идет разбор и формирование чего-то на JavaScript, что я не понял.</p><p>Уточните что именно не работает. Может PHP делает все как надо, а проблемы с JavaScript?</p>]]></description>
			<author><![CDATA[null@example.com (Hanut)]]></author>
			<pubDate>Fri, 29 Jul 2011 17:22:09 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=17112#p17112</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помогите начинающему программисту :)]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=17107#p17107</link>
			<description><![CDATA[<p>Должно, но не работает... А вот почему?<br />У Вас запрос работает?</p>]]></description>
			<author><![CDATA[null@example.com (GrandMasterX)]]></author>
			<pubDate>Thu, 28 Jul 2011 20:21:22 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=17107#p17107</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помогите начинающему программисту :)]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=17105#p17105</link>
			<description><![CDATA[<p>Посмотрел скрипты и дамп, никаких проблем не обнаружил, все должно работать.</p><p>Перекодировка не нужна, потому что данные в БД находятся в Юникоде (utf8), как и сама страница сайта.</p>]]></description>
			<author><![CDATA[null@example.com (Hanut)]]></author>
			<pubDate>Thu, 28 Jul 2011 19:59:25 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=17105#p17105</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помогите начинающему программисту :)]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=17102#p17102</link>
			<description><![CDATA[<p>Отпишите результаты пожайлуста <img src="https://forum.php-myadmin.ru/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[null@example.com (GrandMasterX)]]></author>
			<pubDate>Wed, 27 Jul 2011 17:54:40 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=17102#p17102</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помогите начинающему программисту :)]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=17100#p17100</link>
			<description><![CDATA[<p>Отправил Вам на емейл.</p>]]></description>
			<author><![CDATA[null@example.com (GrandMasterX)]]></author>
			<pubDate>Tue, 26 Jul 2011 19:43:38 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=17100#p17100</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помогите начинающему программисту :)]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=17099#p17099</link>
			<description><![CDATA[<p>Тогда вышлите сам скрипт и дамп таблиц с которыми он работает на hanut@php-myadmin.ru</p><p>Как вышлите файлы, дайте знать.</p>]]></description>
			<author><![CDATA[null@example.com (Hanut)]]></author>
			<pubDate>Tue, 26 Jul 2011 19:23:44 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=17099#p17099</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помогите начинающему программисту :)]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=17098#p17098</link>
			<description><![CDATA[<p>Получается пустое выпадающее меню. Ничего. о_О<br />какой-то бред, нету ошибки а оно вы****.</p>]]></description>
			<author><![CDATA[null@example.com (GrandMasterX)]]></author>
			<pubDate>Tue, 26 Jul 2011 18:41:43 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=17098#p17098</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помогите начинающему программисту :)]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=17096#p17096</link>
			<description><![CDATA[<p>Во втором запросе вместо строки:<br />$res = mysql_query($SQL);<br />Поставьте:<br />if (!$res = mysql_query($SQL)) exit(mysql_error());</p>]]></description>
			<author><![CDATA[null@example.com (Hanut)]]></author>
			<pubDate>Tue, 26 Jul 2011 16:34:42 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=17096#p17096</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помогите начинающему программисту :)]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=17093#p17093</link>
			<description><![CDATA[<p>попробовал вывести так</p><div class="codebox"><pre><code>var_dump($agancy_array);
                echo iconv(&quot;windows-1251&quot;, &quot;utf-8&quot;, $data[0][&quot;name&quot;]);</code></pre></div><p>в результате мне выдало NULL во всех случаях добавления фильтра по городам.</p><p>а когда не добавляешь отбор </p><div class="codebox"><pre><code>AND cо.CName = &#039;$turkey&#039;</code></pre></div><p>или </p><div class="codebox"><pre><code>AND cо.CName = \&quot;Турция\&quot;</code></pre></div><p>то выводит такое<br /></p><div class="codebox"><pre><code>array(31) { [0]=&gt; array(12) { [0]=&gt; string(8) &quot;Adventec&quot; [&quot;title&quot;]=&gt; string(8) &quot;Adventec&quot; [1]=&gt; string(24) &quot;travel@adventecgroup.com&quot; [&quot;email&quot;]=&gt; string(24) &quot;travel@adventecgroup.com&quot; [2]=&gt; string(4) &quot;����&quot; [&quot;city_name&quot;]=&gt; string(4) &quot;����&quot; [3]=&gt; string(4) &quot;1160&quot; [&quot;id&quot;]=&gt; string(4) &quot;1160&quot; [4]=&gt; string(7) &quot;�������&quot; [&quot;cityname&quot;]=&gt; string(7) &quot;�������&quot; [5]=&gt; string(7) &quot;104,223&quot; [&quot;countries&quot;]=&gt; string(7) &quot;104,223&quot; } [1]=&gt; array(12) { [0]=&gt; string(9) &quot;Celebrity&quot; [&quot;title&quot;]=&gt; string(9) &quot;Celebrity&quot; [1]=&gt; string(22) &quot;info@celebrity.kiev.ua&quot; [&quot;email&quot;]=&gt; string(22) &quot;info@celebrity.kiev.ua&quot; [2]=&gt; string(4) &quot;����&quot; [&quot;city_name&quot;]=&gt; string(4) &quot;����&quot; [3]=&gt; string(4) &quot;1160&quot; [&quot;id&quot;]=&gt; string(4) &quot;1160&quot; [4]=&gt; string(9) &quot;���������&quot; [&quot;cityname&quot;]=&gt; string(9) &quot;���������&quot; [5]=&gt; string(17) &quot;13,55,153,223,209&quot; [&quot;countries&quot;]=&gt; string(17) &quot;13,55,153,223,209&quot; } [2]=&gt; array(12) { [0]=&gt; string(11) &quot;Comfortlife&quot; [&quot;title&quot;]=&gt; string(11) &quot;Comfortlife&quot; [1]=&gt; string(20) &quot;ns@comfortlife.in.ua&quot; [&quot;email&quot;]=&gt; string(20) &quot;ns@comfortlife.in.ua&quot; [2]=&gt; string(4) &quot;����&quot; [&quot;city_name&quot;]=&gt; string(4) &quot;����&quot; [3]=&gt; string(4) &quot;1160&quot; [&quot;id&quot;]=&gt; string(4) &quot;1160&quot; [4]=&gt; NULL [&quot;cityname&quot;]=&gt; NULL [5]=&gt; string(2) &quot;44&quot; [&quot;countries&quot;]=&gt; string(2) &quot;44&quot; } [3]=&gt; array(12) { [0]=&gt; string(14) &quot;Diamond Travel&quot; [&quot;title&quot;]=&gt; string(14) &quot;Diamond Travel&quot; [1]=&gt; string(21) &quot;admin@d-travel.com.ua&quot; [&quot;email&quot;]=&gt; string(21) &quot;admin@d-travel.com.ua&quot; [2]=&gt; string(4) &quot;����&quot; </code></pre></div><p>результат есть в общем))только он длиннее намного.</p><p>Что-то я все равно не могу понять почему оно при фильтре таком выбивает NULL, все же правильно!</p><br /><p>Пробовал так как и Вы сказали - результата нету.</p><p>Если попробовать добавить if (!$res = mysql_query($SQL)) exit(mysql_error());&nbsp; &nbsp;то когда таблица грузится при сборе данных и крутится круг загрузки то он просто виснет <img src="https://forum.php-myadmin.ru/img/smilies/smile.png" width="15" height="15" alt="smile" /><br />Обрыв весь интернет, непонятно в чем ошибка, в мануалке тоже ничего. Все правильно, должно работать, НО не работает О_О Что за ..... ???<br />Есть у Вас какие-то еще идеи в чем может быть загвоздка?</p><br /><br /><br /><p>вот весь кусок кода</p><br /><div class="codebox"><pre><code>   &lt;form method=&quot;post&quot; id=&quot;package_order_form&quot;  name=&quot;package_order_form&quot; action=&#039;&#039;&gt;
      &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;package_tour_order_submit&quot; /&gt;
      &lt;input type=&quot;hidden&quot; name=&quot;tour_id&quot; value=&quot;&lt;? echo $search_result[&#039;offers&#039;][0][&#039;id&#039;]; ?&gt;&quot; /&gt;
      &lt;h4&gt;&lt;? echo $lang[&#039;info_about_tourist&#039;]; ?&gt;&lt;/h4&gt;
      &lt;div class=&quot;error_form&quot;&gt;&lt;/div&gt;
      &lt;div class=&quot;package_order_form&quot;&gt;
        &lt;div class=&quot;itt_first_level&quot;&gt;
          &lt;div class=&quot;first_frame&quot;&gt;
              &lt;h4&gt;
        &lt;?php
$turkey=&quot;Австрия&quot;;
                ?&gt;
                
           
              &lt;/h4&gt;
            &lt;?
                include(&quot;../admin/config/db.conf.php&quot;);
                $link = mysql_pconnect($CONFIG[&#039;DB&#039;][&#039;local&#039;][&#039;mysql&#039;][&#039;host&#039;], $CONFIG[&#039;DB&#039;][&#039;local&#039;][&#039;mysql&#039;][&#039;user&#039;], $CONFIG[&#039;DB&#039;][&#039;local&#039;][&#039;mysql&#039;][&#039;password&#039;]);
                mysql_select_db($CONFIG[&#039;DB&#039;][&#039;local&#039;][&#039;mysql&#039;][&#039;db_name&#039;], $link);

                $SQL = &quot;SELECT t.title as title,
t.email as email,
c.name as city_name,
c.city_id as id,
co.CName AS cityname,
co.country_id,
f.countries
     FROM ua_cities c
     LEFT JOIN  tourfirm_offices t ON t.city_id = c.city_id
     LEFT JOIN tourfirms f ON t.firm_id = f.firm_id
     LEFT JOIN countries co ON f.countries LIKE CONCAT( co.country_id, \&quot;,%\&quot; )
     OR f.countries LIKE CONCAT( \&quot;%,\&quot;, co.country_id )
     OR f.countries LIKE CONCAT( \&quot;%,\&quot;, co.country_id, \&quot;,%\&quot; )
  WHERE t.pay_status = 1
  AND co.CName = &#039;$turkey&#039;

  GROUP BY city_name&quot;;
                $res = mysql_query($SQL);

                $out_city = &quot;&quot;;
                while ($info = mysql_fetch_array($res)) {
                    $city_array[] = $info[&quot;id&quot;];
                    $out_city .= &quot;&lt;option value=&#039;&quot;.$info[&quot;id&quot;].&quot;&#039;&gt;&quot;.iconv(&quot;windows-1251&quot;, &quot;utf-8&quot;, $info[&quot;city_name&quot;]).&quot;&lt;/option&gt;&quot;;
                }



                $SQL = &quot;
SELECT t.title as title,
t.email as email,
c.name as city_name,
c.city_id as id,
co.CName AS cityname,
co.country_id,
f.countries
     FROM ua_cities c
     LEFT JOIN  tourfirm_offices t ON t.city_id = c.city_id
     LEFT JOIN tourfirms f ON t.firm_id = f.firm_id
     LEFT JOIN countries co ON f.countries LIKE CONCAT( co.country_id, \&quot;,%\&quot; )
     OR f.countries LIKE CONCAT( \&quot;%,\&quot;, co.country_id )
     OR f.countries LIKE CONCAT( \&quot;%,\&quot;, co.country_id, \&quot;,%\&quot; )
  WHERE t.pay_status = 1
  AND co.CName = &#039;$turkey&#039;
  GROUP BY t.title
 &quot;;
                $res = mysql_query($SQL);

                while ($info = mysql_fetch_array($res)) {
                    $agancy_array[] = $info;
                }

                             //   if (!$res = mysql_query($SQL)) exit(mysql_error());

            //    var_dump($agancy_array);
            //    echo iconv(&quot;windows-1251&quot;, &quot;utf-8&quot;, $data[0][&quot;name&quot;]);
            ?&gt;
                &lt;script&gt;
                      var data = new Array();
                      data[&quot;empty&quot;] = &#039;&lt;select name=&quot;why&quot; style=&quot;width:200px;&quot;&gt;&lt;option&gt;-------&lt;/option&gt;&lt;/select&gt;&#039;;
                      &lt;?
                      foreach ($city_array as $c_key =&gt; $c_value) {

                      ?&gt;
                          data[&quot;&lt;?=$c_value?&gt;&quot;] = &#039;&lt;select name=&quot;why&quot; style=&quot;width:200px;&quot;&gt;&#039;;

                      &lt;?
                        foreach ($agancy_array as $a_key =&gt; $a_value) {
                            if ($a_value[&quot;id&quot;] == $c_value) {
                    ?&gt;
                                data[&quot;&lt;?=$c_value?&gt;&quot;] += &#039;&lt;option value=&quot;&lt;?=$a_value[&quot;email&quot;]?&gt;&quot;&gt;&lt;?=iconv(&quot;windows-1251&quot;, &quot;utf-8&quot;, $a_value[&quot;title&quot;])?&gt;&lt;/option&gt;&#039;;
                    &lt;?
                            }
                        }
                    ?&gt;
                        data[&quot;&lt;?=$c_value?&gt;&quot;] += &#039;&lt;/select&gt;&#039;;
                    &lt;?
                    }
                      ?&gt;
                      function changeCity(obj) {
                          document.getElementById(&quot;office&quot;).innerHTML = data[obj.value];
                      }
                  &lt;/script&gt;
           
                  &lt;table cellspacing=&quot;0&quot; class=&quot;tour_general_touriste&quot; border=&quot;0&quot; align=&quot;center&quot;  id=&#039;order_form_table&#039;&gt;
                &lt;tbody&gt;
                  &lt;tr&gt;
                    &lt;td&gt;&lt;label class=&quot;title_strong&quot;&gt;ФИО&lt;span class=&quot;red_star&quot;&gt;*&lt;/span&gt;:&lt;/label&gt;&lt;/td&gt;
                    &lt;td class=&quot;second&quot;&gt;&lt;input tabindex=&quot;1&quot; id=&quot;second_name&quot; name=&quot;fio&quot; value=&quot;&lt;? echo post(&#039;second_name&#039;); ?&gt;&quot; /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                    &lt;td&gt;&lt;label class=&quot;title_strong&quot;&gt;Город&lt;span class=&quot;red_star&quot;&gt;*&lt;/span&gt;:&lt;/label&gt;&lt;/td&gt;
                    &lt;td class=&quot;second&quot;&gt;&lt;input tabindex=&quot;4&quot; name=&quot;city&quot; value=&quot;&lt;? echo post(&#039;city&#039;); ?&gt;&quot; /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                    &lt;td&gt;&lt;label class=&quot;title_strong&quot;&gt;Телефон&lt;span class=&quot;red_star&quot;&gt;*&lt;/span&gt;:&lt;/label&gt;&lt;/td&gt;
                    &lt;td class=&quot;second&quot;&gt;&lt;input tabindex=&quot;5&quot; name=&quot;tel&quot; value=&quot;&lt;? echo post(&#039;phone&#039;); ?&gt;&quot; /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                    &lt;td&gt;&lt;label class=&quot;title_strong&quot;&gt;E-mail:&lt;/label&gt;&lt;/td&gt;
                    &lt;td class=&quot;second&quot;&gt;&lt;input tabindex=&quot;6&quot; name=&quot;email&quot; value=&quot;&lt;? echo post(&#039;email&#039;); ?&gt;&quot; /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                &lt;/tbody&gt;
              &lt;/table&gt;
              &lt;div style=&quot;float:left; padding-top:10px;&quot; align=&quot;center&quot;&gt;
                  Выберете офис:
              &lt;/div&gt;
              &lt;table cellspacing=&quot;0&quot; class=&quot;tour_general_touriste&quot; border=&quot;0&quot; align=&quot;center&quot;  id=&#039;order_form_table&#039;&gt;
                &lt;tbody&gt;
                  &lt;tr&gt;
                    &lt;td&gt;&lt;label class=&quot;title_strong&quot;&gt;Город:&lt;/label&gt;&lt;/td&gt;
                    &lt;td class=&quot;second&quot;&gt;
                        &lt;select style=&quot;width:200px;&quot; onchange=&quot;changeCity(this)&quot;&gt;
                            &lt;option value=&quot;empty&quot;&gt;-------&lt;/option&gt;
                            &lt;?=$out_city?&gt;
                        &lt;/select&gt;
                    &lt;/td&gt;
                  &lt;/tr&gt;
                 &lt;tr&gt;
                    &lt;td&gt;&lt;label class=&quot;title_strong&quot;&gt;Офис:&lt;/label&gt;&lt;/td&gt;
                    &lt;td class=&quot;second&quot;&gt;
                        &lt;div id=&quot;office&quot;&gt;
                            &lt;select name=&quot;why&quot; style=&quot;width:200px;&quot;&gt;
                                &lt;option&gt;-------&lt;/option&gt;
                            &lt;/select&gt;
                        &lt;/div&gt;
                    &lt;/td&gt;
                  &lt;/tr&gt;
                &lt;/tbody&gt;
              &lt;/table&gt;
              &lt;input type=&quot;hidden&quot; name=&quot;tour&quot; value=&quot;&lt;? echo $search_result[&#039;offers&#039;][0][&#039;id&#039;]; ?&gt;&quot; /&gt;
              &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;send&quot;&gt;
              &lt;input type=&quot;hidden&quot; name=&quot;hash&quot; value=&quot;&lt;?=$hash?&gt;&quot;&gt;
              &lt;input type=&quot;hidden&quot; name=&quot;time&quot; value=&quot;&lt;?=$time?&gt;&quot;&gt;
          &lt;/div&gt;
          &lt;div class=&quot;second_frame&quot;&gt;

                    &lt;span class=&quot;ittour_order_title&quot;&gt;Погода в регионе &lt;? echo $search_result[&#039;offers&#039;][0][&#039;locations&#039;][0][&#039;region_name&#039;]; ?&gt;&lt;/span&gt;

                        &lt;ul&gt;
                    &lt;?
                    if(is_array($search_result[&#039;offers&#039;][0][&#039;weather&#039;])) {
                      foreach($search_result[&#039;offers&#039;][0][&#039;weather&#039;] as $key =&gt; $weather) {
                        if($key &gt; 3)
                          continue;
                        ?&gt;
                        &lt;li&gt;
                            &lt;span class=&quot;ittour_order_ico&quot;&gt;&lt;img src=&quot;http://module.ittour.com.ua/res/images/ico_weather_&lt;? echo $weather[&#039;image_group&#039;]; ?&gt;.gif&quot; alt=&quot;&quot; /&gt;&lt;/span&gt;
                            &lt;span class=&quot;ittour_order_date&quot;&gt;&lt;? echo date(&#039;d.m.y&#039;, strtotime($weather[&#039;date&#039;])) ?&gt;&lt;/span&gt;
                            &lt;span class=&quot;ittour_order_night&quot;  style=&quot;margin-left:10px;font-size:10px;&quot;&gt;ночью: &lt;span class=&quot;ittour_order_bleu_strong&quot;&gt;+&lt;? echo $weather[&#039;temperature_low&#039;] ?&gt;&lt;/span&gt;&lt;span class=&quot;ittour_order_bleu&quot;&gt;°С &lt;/span&gt;&lt;/span&gt;
                            &lt;span class=&quot;ittour_order_day&quot; style=&quot;margin-left:10px;font-size:10px;&quot;&gt;днём: &lt;span class=&quot;ittour_order_bleu_strong&quot;&gt;+&lt;? echo $weather[&#039;temperature_high&#039;] ?&gt;&lt;/span&gt;&lt;span class=&quot;ittour_order_bleu&quot;&gt;°С&lt;/span&gt;&lt;/span&gt;
                        &lt;/li&gt;
                        &lt;?
                      }
                    }
                    ?&gt;
                        &lt;/ul&gt;


          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;send_block&quot;&gt;
        &lt;input id=&quot;package_order_submit_button&quot; tabindex=&quot;9&quot; type=&quot;submit&quot; name=&quot;&quot; value=&quot;&lt;? echo $lang[&#039;send&#039;]; ?&gt;&quot; onclick=&quot;document.package_order_form.submit()&quot; /&gt;&lt;span class=&quot;package_order_load&quot;&gt;&lt;/span&gt;

        &lt;/div&gt;


      &lt;/div&gt;


    &lt;/form&gt;

    &lt;? } ?&gt;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (GrandMasterX)]]></author>
			<pubDate>Tue, 26 Jul 2011 07:51:33 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=17093#p17093</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помогите начинающему программисту :)]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=17085#p17085</link>
			<description><![CDATA[<p>AND cо.CName = &#039;$turkey&#039; - Так будет правильно; строки должны находиться в кавычках.</p><p>Попробуйте найти ошибку таким образом:<br />if (!$res = mysql_query($SQL)) exit(mysql_error());</p>]]></description>
			<author><![CDATA[null@example.com (Hanut)]]></author>
			<pubDate>Mon, 25 Jul 2011 06:17:05 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=17085#p17085</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помогите начинающему программисту :)]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=17083#p17083</link>
			<description><![CDATA[<p>Если честно я не пойму в чем дело...<br /></p><div class="codebox"><pre><code>$SQL = &quot;
SELECT t.title,
t.email,
c.name as city_name,
c.city_id as id,
co.CName AS cityname,
f.countries
     FROM ua_cities c
     LEFT JOIN  tourfirm_offices t ON t.city_id = c.city_id
     LEFT JOIN tourfirms f ON t.firm_id = f.firm_id
     LEFT JOIN countries co ON (f.countries LIKE CONCAT( co.country_id, \&quot;,%\&quot; )
     OR f.countries LIKE CONCAT( \&quot;%,\&quot;, co.country_id )
     OR f.countries LIKE CONCAT( \&quot;%,\&quot;, co.country_id, \&quot;,%\&quot; ))
  WHERE t.pay_status = 1
  AND cо.CName = $turkey
  GROUP BY t.title
    ORDER BY c.name&quot;;</code></pre></div><p>где </p><div class="codebox"><pre><code>$turkey=&quot;Турция&quot;;</code></pre></div><p>Тупо ничего не выводит в выпадающем меню, хотя через SQL в PhpMyAdmin выводит все фирмы где есть направление Турция о_О <br />Пробовал также</p><div class="codebox"><pre><code>WHERE t.pay_status = 1
  AND cо.CName = \&quot;Турция\&quot;</code></pre></div><p>Все равно пусто!<br />и даже через<br /></p><div class="codebox"><pre><code>WHERE t.pay_status = 1
  AND cо.CName = &#039;Турция&#039;</code></pre></div><p>Эфект нулевой...<br />Как Вы думаете, в чем может быть проблема?</p>]]></description>
			<author><![CDATA[null@example.com (GrandMasterX)]]></author>
			<pubDate>Mon, 25 Jul 2011 00:07:15 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=17083#p17083</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помогите начинающему программисту :)]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=17066#p17066</link>
			<description><![CDATA[<div class="quotebox"><cite>GrandMasterX сказал:</cite><blockquote><p>как сделать так что бы повторения не выводились?</p></blockquote></div><p>Это делается через оператор группировки - GROUP BY, который должен предшествовать ORDER BY.<br /></p><div class="codebox"><pre><code>... WHERE t.pay_status = 1
GROUP BY cityname
ORDER BY c.name</code></pre></div><p>В данном условии я ошибки не вижу. Все верно и должно работать, если в поле cо.CName есть запись с точным соответствием слову &quot;Австрия&quot;. Только не забывайте экранировать двойные кавычки внутри SQL запроса.<br /></p><div class="codebox"><pre><code>WHERE t.pay_status = 1
AND cо.CName = &quot;Австрия&quot;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Hanut)]]></author>
			<pubDate>Fri, 22 Jul 2011 15:02:23 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=17066#p17066</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помогите начинающему программисту :)]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=17060#p17060</link>
			<description><![CDATA[<p>И еще инетересный вопрос <img src="https://forum.php-myadmin.ru/img/smilies/smile.png" width="15" height="15" alt="smile" /> Никак не могу понять как бы его сделать.</p><div class="codebox"><pre><code>            &lt;?
                include(&quot;../admin/config/db.conf.php&quot;);
                $link = mysql_pconnect($CONFIG[&#039;DB&#039;][&#039;local&#039;][&#039;mysql&#039;][&#039;host&#039;], $CONFIG[&#039;DB&#039;][&#039;local&#039;][&#039;mysql&#039;][&#039;user&#039;], $CONFIG[&#039;DB&#039;][&#039;local&#039;][&#039;mysql&#039;][&#039;password&#039;]);
                mysql_select_db($CONFIG[&#039;DB&#039;][&#039;local&#039;][&#039;mysql&#039;][&#039;db_name&#039;], $link);

                $SQL = &quot;SELECT t.title,
t.email,
c.name as city_name,
co.CName AS cityname,
f.countries
     FROM tourfirm_offices t
     LEFT JOIN ua_cities c ON c.city_id = t.city_id
     LEFT JOIN tourfirms f ON t.firm_id = f.firm_id
     LEFT JOIN countries co ON f.countries LIKE CONCAT( co.country_id, \&quot;,%\&quot; )
     OR f.countries LIKE CONCAT( \&quot;%,\&quot;, co.country_id )
     OR f.countries LIKE CONCAT( \&quot;%,\&quot;, co.country_id, \&quot;,%\&quot; )
  WHERE t.pay_status = 1
        
    ORDER BY c.name&quot;;
                $res = mysql_query($SQL);

                $out_city = &quot;&quot;;
                while ($info = mysql_fetch_array($res)) {
                    $city_array[] = $info[&quot;id&quot;];
                    $out_city .= &quot;&lt;option value=&#039;&quot;.$info[&quot;id&quot;].&quot;&#039;&gt;&quot;.iconv(&quot;windows-1251&quot;, &quot;utf-8&quot;, $info[&quot;city_name&quot;]).&quot;&lt;/option&gt;&quot;;
                }


                $SQL = &quot;SELECT t.title,
t.email,
c.name as city_name,
co.CName AS cityname,
f.countries
     FROM tourfirm_offices t
     LEFT JOIN ua_cities c ON c.city_id = t.city_id
     LEFT JOIN tourfirms f ON t.firm_id = f.firm_id
     LEFT JOIN countries co ON f.countries LIKE CONCAT( co.country_id, \&quot;,%\&quot; )
     OR f.countries LIKE CONCAT( \&quot;%,\&quot;, co.country_id )
     OR f.countries LIKE CONCAT( \&quot;%,\&quot;, co.country_id, \&quot;,%\&quot; )
  WHERE t.pay_status = 1

    ORDER BY c.name&quot;;
                $res = mysql_query($SQL);

                while ($info = mysql_fetch_array($res)) {
                    $agancy_array[] = $info;
                }
                //var_dump($agancy_array);
                //echo iconv(&quot;windows-1251&quot;, &quot;utf-8&quot;, $data[0][&quot;name&quot;]);
            ?&gt;
                &lt;script&gt;
                      var data = new Array();
                      data[&quot;empty&quot;] = &#039;&lt;select name=&quot;why&quot; style=&quot;width:200px;&quot;&gt;&lt;option&gt;-------&lt;/option&gt;&lt;/select&gt;&#039;;
                      &lt;?
                      foreach ($city_array as $c_key =&gt; $c_value) {

                      ?&gt;
                          data[&quot;&lt;?=$c_value?&gt;&quot;] = &#039;&lt;select name=&quot;why&quot; style=&quot;width:200px;&quot;&gt;&#039;;

                      &lt;?
                        foreach ($agancy_array as $a_key =&gt; $a_value) {
                            if ($a_value[&quot;id&quot;] == $c_value) {
                    ?&gt;
                                data[&quot;&lt;?=$c_value?&gt;&quot;] += &#039;&lt;option value=&quot;&lt;?=$a_value[&quot;email&quot;]?&gt;&quot;&gt;&lt;?=iconv(&quot;windows-1251&quot;, &quot;utf-8&quot;, $a_value[&quot;title&quot;])?&gt;&lt;/option&gt;&#039;;
                    &lt;?
                            }
                        }
                    ?&gt;
                        data[&quot;&lt;?=$c_value?&gt;&quot;] += &#039;&lt;/select&gt;&#039;;
                    &lt;?
                    }
                      ?&gt;
                      function changeCity(obj) {
                          document.getElementById(&quot;office&quot;).innerHTML = data[obj.value];
                      }
                  &lt;/script&gt;</code></pre></div><br /><br /><p>И оно выводит в выпадающем меня столько раз название города, к примеру Киев, сколько есть фирм в этом городе, как сделать так что бы повторения не выводились? И когда выбераешь город в выпадающем списке фирм тоже идут повторения фирм о_О<br />Как это можно убрать? Что бы они только 1 раз писались? Без повторений?:)<br />И, если я добавляю строку к примеру</p><br /><div class="codebox"><pre><code>WHERE t.pay_status = 1
AND cо.CName = &quot;Австрия&quot;</code></pre></div><p>вместо<br /></p><div class="codebox"><pre><code>WHERE t.pay_status = 1</code></pre></div><p>То вообще ничего не выводится.<br />Если пробовать через phpMyAdmin через SQL запрос то все супер, как швейцарские часы.</p>]]></description>
			<author><![CDATA[null@example.com (GrandMasterX)]]></author>
			<pubDate>Fri, 22 Jul 2011 09:35:50 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=17060#p17060</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помогите начинающему программисту :)]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=17027#p17027</link>
			<description><![CDATA[<p>Огромное Вам спасибо!!!<br />Выручили <img src="https://forum.php-myadmin.ru/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[null@example.com (GrandMasterX)]]></author>
			<pubDate>Tue, 19 Jul 2011 18:58:43 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=17027#p17027</guid>
		</item>
	</channel>
</rss>
