<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2524879</guid>
        <pubDate>Fri, 05 Mar 2010 12:01:46 +0000</pubDate>
        <title>Как присвоить переменной результат SQL запроса</title>
        <link>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2524879</link>
        <description><![CDATA[vicis: поставь на форму компонент  Query (например назовём его TempQuery)<br>
тогда смотрим пример:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$querystr = &#39;select id_order,sum_order from orders&#39;;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$this-&#62;TempQuery-&#62;close();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$this-&#62;TempQuery-&#62;SQL = $querystr;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$this-&#62;TempQuery-&#62;open();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// здесь ещё можго было бы проверить на наличие записей...</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$this-&#62;TempQuery-&#62;first();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$xtable = &#39;&#60;table&#62;&#39;;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;while (!$this-&#62;TempQuery-&#62;eof)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$xtable = $xtable.&#39;&#60;tr&#62;&#60;td&#62;&#39;.$this-&#62;TempQuery-&#62;id_order.&#39;&#60;/td&#62;&#60;td&#62;&#39;.$this-&#62;TempQuery-&#62;sum_order.&#39;&#60;/td&#62;&#60;/tr&#62;&#39;;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$this-&#62;TempQuery-&#62;next();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$xtable = $xtable.&#39;&#60;/table&#62;&#39;;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$this-&#62;TempQuery-&#62;close();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo $xtable;</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script>]]></description>
        <author>vicis</author>
        <category>Delphi for PHP</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2524756</guid>
        <pubDate>Fri, 05 Mar 2010 10:50:00 +0000</pubDate>
        <title>Как присвоить переменной результат SQL запроса</title>
        <link>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2524756</link>
        <description><![CDATA[Prosto_Coder: closed]]></description>
        <author>Prosto_Coder</author>
        <category>Delphi for PHP</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2524650</guid>
        <pubDate>Fri, 05 Mar 2010 09:13:27 +0000</pubDate>
        <title>Как присвоить переменной результат SQL запроса</title>
        <link>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2524650</link>
        <description><![CDATA[ViktorXP: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=296538&view=findpost&p=2524626'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Prosto_Coder &#064; <time class="tag-quote__quoted-time" datetime="2010-03-05T08:58:21+00:00">05.03.10, 08:58</time></span><div class='quote '>Как понять &quot;нуно работать поколоночно&quot;? Результат запроса выводит значения для одного поля. Их мене надо записать в одну колонку таблтцы.</div></div>Результат тебе возвращается в виде таблици. которая состоит со строк и колонок.<br>
даже если ты запросишь одно единственное значение то результат тебе все равно вернется в виде таблицы, но она будет состоять с одной строки и одной колонки]]></description>
        <author>ViktorXP</author>
        <category>Delphi for PHP</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2524626</guid>
        <pubDate>Fri, 05 Mar 2010 08:58:21 +0000</pubDate>
        <title>Как присвоить переменной результат SQL запроса</title>
        <link>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2524626</link>
        <description><![CDATA[Prosto_Coder: Как понять &quot;нуно работать поколоночно&quot;? Результат запроса выводит значения для одного поля. Их  мене надо записать в одну колонку таблтцы.]]></description>
        <author>Prosto_Coder</author>
        <category>Delphi for PHP</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2524603</guid>
        <pubDate>Fri, 05 Mar 2010 08:49:36 +0000</pubDate>
        <title>Как присвоить переменной результат SQL запроса</title>
        <link>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2524603</link>
        <description><![CDATA[ViktorXP: <strong class='tag-b'>Prosto_Coder</strong> у тебя опыт работы с базой данных есть? (имеется ввиду вообще не обязательно php или Delphi)<br>
просто результат ты получаешь в виде колонок. посему и работать с им нужно поколоночно (хотя в php можно взять массив и вывести его одним махом, например через print_r(...))]]></description>
        <author>ViktorXP</author>
        <category>Delphi for PHP</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2524580</guid>
        <pubDate>Fri, 05 Mar 2010 08:32:42 +0000</pubDate>
        <title>Как присвоить переменной результат SQL запроса</title>
        <link>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2524580</link>
        <description><![CDATA[Prosto_Coder: Забейте на подсчет строк.<br>
Появилась новая проблемма:<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">$this-&#62;New_Query-&#62;SQL = &quot;какой-то запрос&quot;;</div><div class="code_line">&nbsp;</div><div class="code_line">$this-&#62;New_Query-&#62;close();</div><div class="code_line">$this-&#62;New_Query-&#62;open();</div><div class="code_line">$this-&#62;New_Query-&#62;first();</div><div class="code_line">&nbsp;</div><div class="code_line">while($this-&#62;New_Query-&#62;eof)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp; ?&#62; &#60;tr&#62; &#60;?php</div><div class="code_line">&nbsp;&nbsp; &nbsp; for($j=0;j&#60;27;j++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;?&#62;&#60;td&#62;echo&quot;Здесь должен вывадится результат SQL запроса (Кто-нибудь знает как это сделать? )&quot;&#60;/td&#62;&#60;?php</div><div class="code_line">&nbsp;&nbsp; &nbsp; }</div><div class="code_line">&nbsp;&nbsp; &nbsp; $this-&#62;New_Query-&#62;next();</div><div class="code_line">&nbsp;&nbsp; &nbsp;?&#62;&#60;/tr&#62;&#60;?php</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
Я пробовал ф-ии getSQL и readSQL, но комптлятор говорит, что неможет приобразовать Object в string.<br>
<div class="tag-mod"><div class="tag-mod__prefix">M</div><div class="tag-mod__body">не забываем о подстветке</div></div>]]></description>
        <author>Prosto_Coder</author>
        <category>Delphi for PHP</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2522727</guid>
        <pubDate>Wed, 03 Mar 2010 16:33:50 +0000</pubDate>
        <title>Как присвоить переменной результат SQL запроса</title>
        <link>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2522727</link>
        <description><![CDATA[vicis: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=296538&view=findpost&p=2522143'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>ViktorXP &#064; <time class="tag-quote__quoted-time" datetime="2010-03-03T10:38:40+00:00">03.03.10, 10:38</time></span><div class='quote '>как вариант то <br>
<br>
&#036;this-&gt;OracleQuery1-&gt;SQL = &quot;select count(*) as &#092;&quot;count&#092;&quot; ...&quot;;<br>
&#036;count = &#036;this-&gt;OracleQuery1-&gt;count;<br>
<br>
<br>
а так то как в делфи есть свойство fields где можно получить колонку по позиции. </div></div><br>
ну ребята :wub: <br>
может код и рабочий, но крайне нежелательно использовать зарезервированные названия в переменных и функциях<br>
лучше назови xcount иначе будеш искать ошибку до новых веников (тем более в open source проектах...)<br>
да и кавычки можно опустить<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">$this-&#62;OracleQuery1-&#62;SQL = &quot;select count(*) as xcount ...&quot;;</div><div class="code_line">$xcount = $this-&#62;OracleQuery1-&#62;xcount;</div></ol></div></div></div></div> <br>
кстати - в кавычках этих скорее всего и проблема<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2010-03-03T16:36:12+00:00">03.03.10, 16:36</time></span></span><br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=296538&view=findpost&p=2522166'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Prosto_Coder &#064; <time class="tag-quote__quoted-time" datetime="2010-03-03T10:48:43+00:00">03.03.10, 10:48</time></span><div class='quote '>Click for detailed informationCallstack #0 File: C:&#092;Program Files&#092;CodeGear&#092;Delphi for PHP&#092;2.0&#092;Projects&#092;UVD_24.09.2010_new++&#092;unit1.php Line: 315</div></div><br>
я бы ещё плюсы из пути убрал...]]></description>
        <author>vicis</author>
        <category>Delphi for PHP</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2522168</guid>
        <pubDate>Wed, 03 Mar 2010 10:52:23 +0000</pubDate>
        <title>Как присвоить переменной результат SQL запроса</title>
        <link>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2522168</link>
        <description><![CDATA[ViktorXP: попробуй второй вариант. хотя я точно помню что и первый работает, но перепроверить в данное время не могу. <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2010-03-03T11:00:48+00:00">03.03.10, 11:00</time></span></span><br>
я конечно извиняюсь, а открытие дата сета было произведено? а то всякое бывает. я не написал строчки открытия так как посчитал что это и так понятно]]></description>
        <author>ViktorXP</author>
        <category>Delphi for PHP</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2522166</guid>
        <pubDate>Wed, 03 Mar 2010 10:48:43 +0000</pubDate>
        <title>Как присвоить переменной результат SQL запроса</title>
        <link>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2522166</link>
        <description><![CDATA[Prosto_Coder: Что-то не то:<br><br>Application raised an exception class EPropertyNotFound with message &#39;Trying to access non-existant property OracleQuery-&gt;count in oracle.inc.php, line 1161.&#39;<br>Click for detailed informationCallstack #0 File: C:&#092;Program Files&#092;CodeGear&#092;Delphi for PHP&#092;2.0&#092;Projects&#092;UVD_24.09.2010_new++&#092;unit1.php Line: 315<br>  |_Callstack #1 File: C:&#092;Program Files&#092;CodeGear&#092;Delphi for PHP&#092;2.0&#092;vcl&#092;classes.inc.php Line: 1925<br>    |_Callstack #2 File: C:&#092;Program Files&#092;CodeGear&#092;Delphi for PHP&#092;2.0&#092;vcl&#092;classes.inc.php Line: 1999<br>      |_Callstack #3 File: C:&#092;Program Files&#092;CodeGear&#092;Delphi for PHP&#092;2.0&#092;vcl&#092;controls.inc.php Line: 1988<br>        |_Callstack #4 File: C:&#092;Program Files&#092;CodeGear&#092;Delphi for PHP&#092;2.0&#092;vcl&#092;classes.inc.php Line: 1564<br>          |_Callstack #5 File: C:&#092;Program Files&#092;CodeGear&#092;Delphi for PHP&#092;2.0&#092;vcl&#092;stdctrls.inc.php Line: 3832<br>            |_Callstack #6 File: C:&#092;Program Files&#092;CodeGear&#092;Delphi for PHP&#092;2.0&#092;vcl&#092;classes.inc.php Line: 1456<br>              |_Callstack #7 File: C:&#092;Program Files&#092;CodeGear&#092;Delphi for PHP&#092;2.0&#092;Projects&#092;UVD_24.09.2010_new++&#092;unit1.php Line: 161<br>                |_Callstack #8 File: C:&#092;Program Files&#092;CodeGear&#092;Delphi for PHP&#092;2.0&#092;vcl&#092;oracle.inc.php Line: 1161]]></description>
        <author>Prosto_Coder</author>
        <category>Delphi for PHP</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2522143</guid>
        <pubDate>Wed, 03 Mar 2010 10:38:40 +0000</pubDate>
        <title>Как присвоить переменной результат SQL запроса</title>
        <link>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2522143</link>
        <description><![CDATA[ViktorXP: как вариант то <br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">$this-&#62;OracleQuery1-&#62;SQL = &quot;select count(*) as \&quot;count\&quot; ...&quot;;</div><div class="code_line">$count = $this-&#62;OracleQuery1-&#62;count;</div></ol></div></div></div></div><br>
а так то как в делфи есть свойство fields где можно получить колонку по позиции.]]></description>
        <author>ViktorXP</author>
        <category>Delphi for PHP</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2522116</guid>
        <pubDate>Wed, 03 Mar 2010 10:19:57 +0000</pubDate>
        <title>Как присвоить переменной результат SQL запроса</title>
        <link>https://forum.sources.ru/index.php?showtopic=296538&amp;view=findpost&amp;p=2522116</link>
        <description><![CDATA[Prosto_Coder: Добрый день&#33;<br>
Есть SQL запрос на подсчет строк в таблтце:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">$this-&#62;OracleQuery1-&#62;SQL = &quot;select.........&quot;;</div></ol></div></div></div></div><br>
<br>
Как присвоить результат этого запоса переменной?]]></description>
        <author>Prosto_Coder</author>
        <category>Delphi for PHP</category>
      </item>
	
      </channel>
      </rss>
	