cvs: phpdoc-zh /reference/mysql/functions mysql-create-db.xml mysql-data-seek.xml
| From: | Dallas Thunder | Date: | Tue, 25 Feb 2003 09:51:58 +0000 |
| Subject: | cvs: phpdoc-zh /reference/mysql/functions mysql-create-db.xml mysql-data-seek.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-1136@lists.php.net to get a copy of this message | ||
dallas Tue Feb 25 04:51:58 2003 EDT
Added files:
/phpdoc-zh/reference/mysql/functions mysql-create-db.xml
mysql-data-seek.xml
Log:
Complete 1.4 1.5
Index: phpdoc-zh/reference/mysql/functions/mysql-create-db.xml
+++ phpdoc-zh/reference/mysql/functions/mysql-create-db.xml
<?xml version="1.0" encoding="gb2312"?>
<!-- $Revision: 1.1 $ -->
<!-- $Author: dallas $ -->
<!-- EN-Revision: 1.4 Maintainer: dallas Status: ready -->
<refentry id="function.mysql-create-db">
<refnamediv>
<refname>mysql_create_db</refname>
<refpurpose>н¨Ò»¸ö MySQL Êý¾Ý¿â</refpurpose>
</refnamediv>
<refsect1>
<title>˵Ã÷</title>
<methodsynopsis>
<type>bool</type><methodname>mysql_create_db</methodname>
<methodparam><type>string</type><parameter>database
name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_create_db</function>
³¢ÊÔÔÚÖ¸¶¨µÄÁ¬½Ó±êʶËù¹ØÁªµÄ·þÎñÆ÷ÉϽ¨Á¢Ò»¸öÐÂÊý¾Ý¿â¡£
</para>
<para>
&return.success;
</para>
<example>
<title>MySQL н¨Êý¾Ý¿âÀý×Ó</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_pconnect("localhost", "mysql_user",
"mysql_password")
or die("Could not connect: " . mysql_error());
if (mysql_create_db("my_db")) {
print ("Database created successfully\n");
} else {
printf ("Error creating database: %s\n", mysql_error());
}
?>
]]>
</programlisting>
</example>
<para>
ΪÏòϼæÈÝÒ²¿ÉÒÔÓÃ
<function>mysql_createdb</function>£¬µ«²¢²»Ìᳫ¡£
</para>
<note>
<para>
²»ÌᳫʹÓú¯Êý <function>mysql_create_db</function>¡£×îºÃÓÃ
<function>mysql_query</function> À´Ìá½»Ò»Ìõ
SQL CREATE DATABASE Óï¾äÀ´Ìæ´ú¡£
</para>
</note>
<para>
²Î¼û <function>mysql_drop_db</function> ºÍ
<function>mysql_query</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
-->
Index: phpdoc-zh/reference/mysql/functions/mysql-data-seek.xml
+++ phpdoc-zh/reference/mysql/functions/mysql-data-seek.xml
<?xml version="1.0" encoding="gb2312"?>
<!-- $Revision: 1.1 $ -->
<!-- $Author: dallas $ -->
<!-- EN-Revision: 1.5 Maintainer: dallas Status: ready -->
<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>
½«Ö¸¶¨µÄ½á¹û±êʶËù¹ØÁªµÄ
MySQL ½á¹ûÄÚ²¿µÄÐÐÖ¸ÕëÒÆ¶¯µ½Ö¸¶¨µÄÐкš£½Ó×ŵ÷ÓÃ
<function>mysql_fetch_row</function> ½«·µ»ØÄÇÒ»ÐС£
</para>
<para>
<parameter>row_number</parameter> ´Ó 0
¿ªÊ¼¡£<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>
<example>
<title>MySQL Êý¾Ý¼ìË÷Àý×Ó</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());
/* fetch rows in reverse order */
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>
²Î¼û <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
-->