mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-26 13:58:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@153793 c90b9560-bf6c-de11-be94-00142212c4b1
159 lines
4.3 KiB
XML
159 lines
4.3 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.13 $ -->
|
|
<!-- EN-Revision: 1.12 Maintainer: baoengb Status: ready -->
|
|
<refentry id="function.mysqli-data-seek">
|
|
<refnamediv>
|
|
<refname>mysqli_data_seek</refname>
|
|
<refname>result->data_seek</refname>
|
|
<refpurpose>Ajusta el apuntador arbitrariamente a una fila en el resultado</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Descripción</title>
|
|
<para>Estilo por procedimientos:</para>
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>mysqli_data_seek</methodname>
|
|
<methodparam><type>objeto</type><parameter>resultado</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>posición</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>Estilo orientado a objetos (método):</para>
|
|
<classsynopsis>
|
|
<ooclass><classname>resultado</classname></ooclass>
|
|
<methodsynopsis>
|
|
<type>bool</type>
|
|
<methodname>data_seek</methodname>
|
|
<methodparam><type>int</type><parameter>posición</parameter></methodparam>
|
|
</methodsynopsis>
|
|
</classsynopsis>
|
|
<para>
|
|
La función <function>mysqli_data_seek</function> busca arbitrariamente
|
|
apuntar al valor específicado por <parameter>posición</parameter>
|
|
en el conjunto resultante representado por <parameter>result</parameter>.
|
|
Los valores del parámetro <parameter>posición</parameter>
|
|
deben estar entre cero y el total de filas menus uno (0 .. <function>mysqli_num_rows</function> - 1).
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Está función solo puede ser usada con resultados sin almacenamiento
|
|
intermedio logrados por el uso de las funciones
|
|
<function>mysqli_store_result</function> o <function>mysqli_query</function>.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
<refsect1>
|
|
<title>Valores regresados</title>
|
|
<para>
|
|
&return.success;
|
|
</para>
|
|
</refsect1>
|
|
<refsect1>
|
|
<title>Vea también</title>
|
|
<para>
|
|
<function>mysqli_store_result</function>,
|
|
<function>mysqli_fetch_row</function>,
|
|
<function>mysqli_num_rows</function>.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1>
|
|
<title>Ejemplos</title>
|
|
<example>
|
|
<title>Estilo orientado a onjetos</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
/* Open a connection */
|
|
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
|
|
|
|
/* check connection */
|
|
if (mysqli_connect_errno()) {
|
|
printf("Connect failed: %s\n", mysqli_connect_error());
|
|
exit();
|
|
}
|
|
|
|
$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
|
|
if ($result = $mysqli->query( $query)) {
|
|
|
|
/* seek to row no. 400 */
|
|
$result->data_seek(399);
|
|
|
|
/* fetch row */
|
|
$row = $result->fetch_row();
|
|
|
|
printf ("City: %s Countrycode: %s\n", $row[0], $row[1]);
|
|
|
|
/* free result set*/
|
|
$result->close();
|
|
}
|
|
|
|
/* close connection */
|
|
$mysqli->close();
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<example>
|
|
<title>Estilo por procedimientos</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
/* Open a connection */
|
|
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
|
|
|
|
/* check connection */
|
|
if (!$link) {
|
|
printf("Connect failed: %s\n", mysqli_connect_error());
|
|
exit();
|
|
}
|
|
|
|
$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
|
|
|
|
if ($result = mysqli_query($link, $query)) {
|
|
|
|
/* seek to row no. 400 */
|
|
mysqli_data_seek($result, 399);
|
|
|
|
/* fetch row */
|
|
$row = mysqli_fetch_row($result);
|
|
|
|
printf ("City: %s Countrycode: %s\n", $row[0], $row[1]);
|
|
|
|
/* free result set*/
|
|
mysqli_free_result($result);
|
|
}
|
|
|
|
/* close connection */
|
|
mysqli_close($link);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<para>
|
|
Los ejemplos anteriores producirán la siguiente salida:
|
|
</para>
|
|
<screen>
|
|
<![CDATA[
|
|
City: Benin City Countrycode: NGA
|
|
]]>
|
|
</screen>
|
|
</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
|
|
-->
|