Files
php-doc-ru/reference/mysql/functions/mysql-error.xml
Boris Bezrukov f7dc059834 Data types replaced with english equivalent
git-svn-id: https://svn.php.net/repository/phpdoc/ru/trunk@152373 c90b9560-bf6c-de11-be94-00142212c4b1
2004-02-25 17:47:50 +00:00

86 lines
2.6 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="windows-1251"?>
<!-- $Revision: 1.2 $ -->
<!-- EN-Revision: 1.9 Maintainer: lovchy Status: ready -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-error">
<refnamediv>
<refname>mysql_error</refname>
<refpurpose>
Возвращает строку ошибки последней операции с MySQL.
</refpurpose>
</refnamediv>
<refsect1>
<title>Описание</title>
<methodsynopsis>
<type>string</type><methodname>mysql_error</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
Возвращает строку, содержащую текст ошибки выполнения последней функции
MySQL, или <literal>''</literal> (пустая строка) если операция выполнена
успешно. Если в функцию не передан параметр ссылки на соединение,
последнее открытое соединение будет использовано.
</para>
<para>
Ошибки работы с MySQL больше не вызывают сообщений в PHP. Вместо
этого используйте функцию <function>mysql_errno</function>, чтобы
получить код ошибки. Учтите, что функция возвращает код ошибки только
последней выполненной функции (исключая <function>mysql_error</function> и
<function>mysql_errno</function>). Проверяйте результат работы функции до
вызова следующей.
<example>
<title>Пример использования mysql_error</title>
<programlisting role="php">
<![CDATA[
<?php
mysql_connect("localhost", "mysql_user", "mysql_password");
mysql_select_db("nonexistentdb");
echo mysql_errno() . ": " . mysql_error(). "\n";
mysql_select_db("kossu");
mysql_query("SELECT * FROM nonexistenttable");
echo mysql_errno() . ": " . mysql_error() . "\n";
?>
]]>
</programlisting>
<para>
Вышеописанный код выдаст следующий результат:
</para>
<screen>
<![CDATA[
1049: Unknown database 'nonexistentdb'
1146: Table 'kossu.nonexistenttable' doesn't exist
]]>
</screen>
</example>
</para>
<para>
См. также <function>mysql_errno</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
-->