<?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=1244</link>
		<atom:link href="https://forum.php-myadmin.ru/extern.php?action=feed&amp;tid=1244&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «что нужно исправить чтобы инф-ция из базы выходила в обратном порядке?».]]></description>
		<lastBuildDate>Mon, 18 May 2009 22:07:16 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: что нужно исправить чтобы инф-ция из базы выходила в обратном порядке?]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=8263#p8263</link>
			<description><![CDATA[<p><strong>andreyoxide</strong><br />Все разжевывать не буду, обозначу только основные моменты:<br />1) for ($i=1; $i&lt;$num_rows; $i++) { // Переворачиваем. for ($i=$num_rows; $i&gt;0; $i--) {<br />2) $result = mysql_query(&quot;SELECT * from musicminimals ORDER by id asc limit $str, $nomer&quot;); // Если была прямая (asc) сортировка, то следует перевернуть ее на desc.<br />3) Обратите внимание на обработку текущей страницы получаемой из GET[&#039;str&#039;].</p>]]></description>
			<author><![CDATA[null@example.com (Hanut)]]></author>
			<pubDate>Mon, 18 May 2009 22:07:16 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=8263#p8263</guid>
		</item>
		<item>
			<title><![CDATA[что нужно исправить чтобы инф-ция из базы выходила в обратном порядке?]]></title>
			<link>https://forum.php-myadmin.ru/viewtopic.php?pid=8259#p8259</link>
			<description><![CDATA[<p>что нужно исправить чтобы инф-ция из базы выходила в обратном порядке?<br />сейчас она выводится начиная с id-1.<br />&lt;?</p><p> include (&quot;blocks/bd.php&quot;);<br />&nbsp; &nbsp; $db = &#039;gb_osnova&#039;; // БАЗА ДАННЫХ<br />&nbsp; &nbsp; $table = &#039;musicminimals&#039;; // НАЗВАНИЕ ТАБЛИЦЫ</p><p>&nbsp; &nbsp; $chislo = 5; // ЧИСЛО СООБЩЕНИЙ НА СТРАНИЦЕ</p><p>&nbsp; &nbsp; // ДЛЯ УДОБСТВА ОБОЗНАЧИМ ПЕРЕМЕННУЮ С ТЕКСТОМ ОШИБКИ<br />&nbsp; &nbsp; $text_error = &#039;&lt;br /&gt;Ошибочка вышла!&#039;;</p><p>&nbsp; &nbsp; // СОЕДЕНИМСЯ С MySQL<br />&nbsp; &nbsp; $connect = mysql_connect (&quot;mysql41.1gb.ru&quot;,&quot;gb_osnova&quot;,&quot;9d238dbd&quot;);<br />&nbsp; &nbsp; if (!$connect) {<br />&nbsp; &nbsp; echo $text_error;<br />&nbsp; &nbsp; exit;<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; // СОЕДЕНИЯЕМСЯ С БАЗОЙ ДАННЫХ<br />&nbsp; &nbsp; $select = mysql_select_db($db);<br />&nbsp; &nbsp; if (!$select) {<br />&nbsp; &nbsp; echo $text_error;<br />&nbsp; &nbsp; exit;<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; // СОЗДАЁМ ЗАПРОС<br />&nbsp; &nbsp; $result = mysql_query(&quot;SELECT * from $table ORDER by id desc&quot;);<br />&nbsp; &nbsp; // СЧИТАЕМ КОЛЛИЧЕСТВО ЗАПИСЕЙ В ТАБЛИЦЕ - У МЕНЯ ИХ 20<br />&nbsp; &nbsp; $num_rows = mysql_num_rows($result);</p><p>&nbsp; &nbsp; // А ТЕПЕРЬ СЧИТАЕМ НА СКОЛЬКО СТРАНИЦ НАМ РАЗБИТЬ ЗАПИСИ И ВЫДЕЛЯЕМ ЦЕЛОЕ ЧИСЛО<br />&nbsp; &nbsp; $num_rows = round($num_rows/$chislo); // 20 ДЕЛИМ НА 5. СКОЛЬКО? <img src="https://forum.php-myadmin.ru/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><br /><p>&nbsp; &nbsp; // ЗДЕСЬ МЫ ПРОВЕРЯЕМ НА КАКОЙ СТРАНИЦЕ СЕЙЧАС ПОЛЬЗОВАТЕЛЬ<br />&nbsp; &nbsp; if (isset($_GET[&#039;str&#039;])) {<br />&nbsp; &nbsp; $nav = $_GET[&#039;str&#039;];<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; else {<br />&nbsp; &nbsp; $nav = 0;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; $nav = intval($nav); // ДЛЯ ЗАЩИТЫ ОТ НЕХОРОШИХ ДЯДЕНЕК МЫ ВЫДЕЛИМ ЦЕЛУЮ ЧАСТЬ $GET[&#039;str&#039;]<br />&nbsp; &nbsp; echo &#039;Навигация:&#039;;</p><p>&nbsp; &nbsp; // А ТЕПЕРЬ ВЫВОДИМ НОМЕРА СТРАНЦ<br />&nbsp; &nbsp; for ($i=1; $i&lt;$num_rows; $i++) {<br />&nbsp; &nbsp; if ($i != $nav) {<br />&nbsp; &nbsp; echo &#039;&lt;a href=&quot;&#039;.$PHP_SELF.&#039;?str=&#039;.$i.&#039;&quot;&gt;&#039;.$i.&#039;&lt;/a&gt; &#039;;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; else {<br />&nbsp; &nbsp; // АКТИВНУЮ СТРАНИЦУ ДЕЛАЕМ НЕ ГИПЕРССЫЛКОЙ<br />&nbsp; &nbsp; echo &#039;&lt;span&gt;&#039;.$i.&#039;&lt;/span&gt; &#039;;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; echo &#039;&lt;hr /&gt;&#039;; // ОТДЕЛИМ НАВИГАЦЮ ОТ КОНТЕНТА ДЛЯ НАГЛЯДНОСТИ</p><p>&nbsp; &nbsp; // НАЧИНАЕМ ВЫВОДИТЬ САМУ ИНФОРМАЦИЮ ПОСТРАНИЧНО <img src="https://forum.php-myadmin.ru/img/smilies/smile.png" width="15" height="15" alt="smile" /><br />&nbsp; &nbsp; if (!isset($_GET[&#039;str&#039;])) {<br />&nbsp; &nbsp; $str = 0;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; else {<br />&nbsp; &nbsp; $str = $_GET[&#039;str&#039;]*$chislo - $chislo;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; $nomer = $str + 5;<br />&nbsp; &nbsp; // ФОРМИРУЕМ ЗАПРОС НУЖНОЙ НАМ ЧАСТИ ИНФОРМАЦИИ<br />&nbsp; &nbsp; $result = mysql_query(&quot;SELECT * from musicminimals ORDER by id asc limit $str, $nomer&quot;);<br />&nbsp; &nbsp; $myrow = mysql_fetch_array($result);</p><p>do {</p><p>printf (&quot;&lt;table cellspacing=&#039;2&#039; cellpadding=&#039;2&#039; height=&#039;160&#039; class=&#039;tbmusic2&#039; &gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;tr&gt;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &lt;td rowspan=&#039;4&#039; width=&#039;150&#039;&gt;%s&lt;/td&gt;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &lt;td class=&#039;tbmusic2&#039; width=&#039;590&#039; &gt;&lt;p titlealbom class=&#039;text_titlealbom&#039;&gt;%s&lt;/p&gt;&lt;/td&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/tr&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;tr&gt;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &lt;td class=&#039;tbmusic2&#039;&gt;&lt;p class=&#039;text_info&#039;&gt;%s&lt;/p&gt;&lt;/td&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/tr&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;tr&gt;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &lt;td class=&#039;tbmusic2&#039;&gt;&lt;p class=&#039;text_download&#039;&gt;%s&lt;/p&gt;&lt;/td&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/tr&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;tr&gt;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &lt;td class=&#039;tbmusic2&#039;&gt;&lt;p class=&#039;text_data&#039;&gt;Дата добавления:%s&lt;/p&gt;&lt;/td&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/tr&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/table&gt;&lt;br&gt;&quot;, $myrow[&quot;imj&quot;],$myrow[&quot;title&quot;],$myrow[&quot;info&quot;],$myrow[&quot;musicss&quot;],$myrow[&quot;date&quot;]&nbsp; );</p><p> }</p><p>while ($myrow = mysql_fetch_array($result));</p><p>&nbsp; // ИНАЧЕ ВЫВОДИМ ОШИБКУ<br />&nbsp; &nbsp; if (!$result) {<br />&nbsp; &nbsp; echo $text_error;<br />&nbsp; &nbsp; exit;<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; echo &#039;&lt;div style=&quot;width: 40%;&quot;&gt;&#039;;<br />&nbsp; &nbsp; while ($row = mysql_fetch_array($result)) {<br />&nbsp; &nbsp; echo &#039;&lt;p&gt;&#039;.$row[&#039;id&#039;].&#039; - &lt;strong&gt;&#039;.$row[&#039;name&#039;].&#039;&lt;/strong&gt;<br />&nbsp; &nbsp; &lt;br /&gt;<br />&nbsp; &nbsp; &#039;.substr($row[&#039;text&#039;],0,100).&#039;.. &lt;a href=&quot;text.php?nomer=&#039;.$row[&#039;id&#039;].&#039;&quot;&gt;&gt;&gt;&lt;/a&gt;&lt;/p&gt;&#039;;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; echo &#039;&lt;/div&gt;&#039;;</p><p>&nbsp; &nbsp; mysql_close($connect);<br />?&gt;</p>]]></description>
			<author><![CDATA[null@example.com (andreyoxide)]]></author>
			<pubDate>Mon, 18 May 2009 14:44:14 +0000</pubDate>
			<guid>https://forum.php-myadmin.ru/viewtopic.php?pid=8259#p8259</guid>
		</item>
	</channel>
</rss>
