Files
php-doc-ru/reference/mysql/reference.xml
2007-12-10 17:13:08 +00:00

115 lines
3.5 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="utf-8"?>
<!-- $Revision: 1.5 $ -->
<!-- EN-Revision: 1.16 Maintainer: lovchy Status: ready -->
<reference xml:id="ref.mysql" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Функции СУБД MySQL</title>
<titleabbrev>MySQL</titleabbrev>
<partintro>
<section xml:id="mysql.intro">
&reftitle.intro;
<para>
Расширение позволяет вам работать с СУБД MySQL.
За информацией о MySQL обращайтесь к <link
xlink:href="&url.mysql;">&url.mysql;</link>.
</para>
<para>
Документация MySQL находится по адресу <link
xlink:href="&url.mysql.docs;">&url.mysql.docs;</link>.
</para>
</section>
<section xml:id="mysql.requirements">
&reftitle.required;
<para>
Чтобы работать с функциями, вы должны скомпилировать PHP с поддержкой
MySQL.
</para>
</section>
&reference.mysql.configure;
&reference.mysql.ini;
<section xml:id="mysql.resources">
&reftitle.resources;
<para>
Модуль MySQL исползует два дополнительных типа указателей. Первый
является указателем на соединение с базой данных, второй указывает на
ресурс, содержащий результат запроса.
</para>
</section>
&reference.mysql.constants;
<section xml:id="mysql.examples">
&reftitle.examples;
<para>
Этот пример показывает, как соединиться с базой данных, выполнить запрос,
распечатать результат и отсоединиться.
<example>
<title>Пример работы с MySQL</title>
<programlisting role="php">
<![CDATA[
<?php
/* Соединяемся, выбираем базу данных */
$link = mysql_connect("mysql_host", "mysql_user", "mysql_password")
or die("Could not connect : " . mysql_error());
print "Connected successfully";
mysql_select_db("my_database") or die("Could not select database");
/* Выполняем SQL-запрос */
$query = "SELECT * FROM my_table";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
/* Выводим результаты в html */
print "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
print "\t<tr>\n";
foreach ($line as $col_value) {
print "\t\t<td>$col_value</td>\n";
}
print "\t</tr>\n";
}
print "</table>\n";
/* Освобождаем память от результата */
mysql_free_result($result);
/* Закрываем соединение */
mysql_close($link);
?>
]]>
</programlisting>
</example>
</para>
</section>
</partintro>
&reference.mysql.entities.functions;
</reference>
<!-- 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
-->