mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-20 10:58:54 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@153793 c90b9560-bf6c-de11-be94-00142212c4b1
124 lines
3.5 KiB
XML
124 lines
3.5 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.11 $ -->
|
|
<!-- EN-Revision: 1.10 Maintainer: baoengb Status: ready -->
|
|
<refentry id="function.mysqli-error">
|
|
<refnamediv>
|
|
<refname>mysqli_error</refname>
|
|
<refpurpose>Regresa una cadena con la descripció del último error</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Descripción</title>
|
|
<para>Estilo por procedimientos:</para>
|
|
<methodsynopsis>
|
|
<type>cadena</type><methodname>mysqli_error</methodname>
|
|
<methodparam><type>objeto</type><parameter>identificador_de_enlace</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>Estilo orientado a objetos (propiedad)</para>
|
|
<classsynopsis>
|
|
<ooclass><classname>mysqli</classname></ooclass>
|
|
<fieldsynopsis><type>cadena</type><varname>error</varname></fieldsynopsis>
|
|
</classsynopsis>
|
|
<para>
|
|
La funció <function>mysqli_error</function> es identica a la correspondiente
|
|
<function>mysqli_errno</function> en todos los sentidos, excepto en que en
|
|
lugar de regresar un valor numérico, la función <function>mysqli_error</function>
|
|
regresará un mensaje de error, representando el último error
|
|
ocurrido para la conexió de base de datos <parameter>identificador_de_enlace</parameter>.
|
|
Si no han ocurrido errores, está función regresará una cadena vacía.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1>
|
|
<title>Valores regresados</title>
|
|
<para>
|
|
Una cadena que describe el error. Una cadena vacía si no han ocurrido
|
|
errores.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1>
|
|
<title>Vea también</title>
|
|
<para>
|
|
<function>mysqli_connect_errno</function>,
|
|
<function>mysqli_connect_error</function>,
|
|
<function>mysqli_errno</function>,
|
|
<function>mysqli_sqlstate</function>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1>
|
|
<title>Ejemplos</title>
|
|
<example>
|
|
<title>Estilo orientado a objetos</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
|
|
|
|
/* check connection */
|
|
if (mysqli_connect_errno()) {
|
|
printf("Connect failed: %s\n", mysqli_connect_error());
|
|
exit();
|
|
}
|
|
|
|
if (!$mysqli->query("SET a=1")) {
|
|
printf("Errormessage: %s\n", $mysqli->error);
|
|
}
|
|
|
|
/* close connection */
|
|
$mysqli->close();
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<example>
|
|
<title>Estilo por procedimientos</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
|
|
|
|
/* check connection */
|
|
if (mysqli_connect_errno()) {
|
|
printf("Connect failed: %s\n", mysqli_connect_error());
|
|
exit();
|
|
}
|
|
|
|
if (!mysqli_query($link, "SET a=1")) {
|
|
printf("Errormessage: %s\n", mysqli_error($link));
|
|
}
|
|
|
|
/* close connection */
|
|
mysqli_close($link);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<para>
|
|
Los ejemplos anteriores producirán la siguiente salida:
|
|
</para>
|
|
<screen>
|
|
<![CDATA[
|
|
Errormessage: Unknown system variable 'a'
|
|
]]>
|
|
</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
|
|
-->
|