mirror of
https://github.com/php/doc-ru.git
synced 2025-08-13 15:20:56 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/ru/trunk@152373 c90b9560-bf6c-de11-be94-00142212c4b1
98 lines
2.9 KiB
XML
98 lines
2.9 KiB
XML
<?xml version="1.0" encoding="windows-1251"?>
|
|
<!-- $Revision: 1.3 $ -->
|
|
<!-- EN-Revision: 1.6 Maintainer: lovchy Status: ready -->
|
|
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
|
|
<refentry id="function.mysql-data-seek">
|
|
<refnamediv>
|
|
<refname>mysql_data_seek</refname>
|
|
<refpurpose>Ïåðåìåùàåò âíóòðåííèé óêàçàòåëü â ðåçóëüòàòå çàïðîñà</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Îïèñàíèå</title>
|
|
<methodsynopsis >
|
|
<type>bool</type><methodname>mysql_data_seek</methodname>
|
|
<methodparam><type>resource</type><parameter>result_identifier</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>row_number</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
&return.success;
|
|
</para>
|
|
<para>
|
|
<function>mysql_data_seek</function> ïåðåìåùàåò âíóòðåííèé óêàçàòåëü â
|
|
ðåçóëüòàòå çàïðîñà ê ðÿäó ñ óêàçàííûì íîìåðîì. Ñëåäóþùèé âûçîâ
|
|
<function>mysql_fetch_row</function> âåðí¸ò èìåííî åãî.
|
|
</para>
|
|
<para>
|
|
Ïàðàìåòð <parameter>Row_number</parameter> äîëæåí áûòü çíà÷åíèåì îò 0 äî mysql_num_rows - 1.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Ôóíêöèÿ <function>mysql_data_seek</function> ìîæåò áûòü èñïîëüçîâàíà
|
|
òîëüêî ñ <function>mysql_query</function>, íî íå ñ
|
|
<function>mysql_unbuffered_query</function>.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
<example>
|
|
<title>Ïðèìåð èñïîëüçîâàíèÿ <function>mysql_data_seek</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$link = mysql_pconnect("localhost", "mysql_user", "mysql_password")
|
|
or die("Could not connect: " . mysql_error());
|
|
|
|
mysql_select_db("samp_db")
|
|
or die("Could not select database: " . mysql_error());
|
|
|
|
$query = "SELECT last_name, first_name FROM friends";
|
|
$result = mysql_query($query)
|
|
or die("Query failed: " . mysql_error());
|
|
|
|
/* ïîëó÷åíèå ðÿäîâ â îáðàòíîì ïîðÿäêå */
|
|
for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) {
|
|
if (!mysql_data_seek($result, $i)) {
|
|
echo "Cannot seek to row $i: " . mysql_error() . "\n";
|
|
continue;
|
|
}
|
|
|
|
if(!($row = mysql_fetch_object($result)))
|
|
continue;
|
|
|
|
echo "$row->last_name $row->first_name<br />\n";
|
|
}
|
|
|
|
mysql_free_result($result);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
Ñì. òàêæå
|
|
<function>mysql_query</function> è
|
|
<function>mysql_num_rows</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|