cvs: phpdoc-zh /reference/mysql/functions mysql-query.xml
| From: | Dallas Thunder | Date: | Tue, 04 Mar 2003 10:23:05 +0000 |
| Subject: | cvs: phpdoc-zh /reference/mysql/functions mysql-query.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-1171@lists.php.net to get a copy of this message | ||
dallas Tue Mar 4 05:23:05 2003 EDT
Added files:
/phpdoc-zh/reference/mysql/functions mysql-query.xml
Log:
Completed.
Index: phpdoc-zh/reference/mysql/functions/mysql-query.xml
+++ phpdoc-zh/reference/mysql/functions/mysql-query.xml
<?xml version="1.0" encoding="gb2312"?>
<!-- $Revision: 1.1 $ -->
<!-- $Author: dallas $ -->
<!-- EN-Revision: 1.4 Maintainer: dallas Status: ready -->
<refentry id="function.mysql-query">
<refnamediv>
<refname>mysql_query</refname>
<refpurpose>·¢ËÍÒ»Ìõ MySQL ²éѯ</refpurpose>
</refnamediv>
<refsect1>
<title>˵Ã÷</title>
<methodsynopsis>
<type>resource</type><methodname>mysql_query</methodname>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
<methodparam
choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>result_mode</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_query</function>
ÏòÓëÖ¸¶¨µÄÁ¬½Ó±êʶ·û¹ØÁªµÄ·þÎñÆ÷Öеĵ±Ç°»î¶¯Êý¾Ý¿â·¢ËÍÒ»Ìõ²éѯ¡£Èç¹ûûÓÐÖ¸¶¨
<parameter>link_identifier</parameter>£¬ÔòʹÓÃÉÏÒ»¸ö´ò¿ªµÄÁ¬½Ó¡£Èç¹ûûÓдò¿ªµÄÁ¬½Ó£¬±¾º¯Êý»á³¢ÊÔÎÞ²ÎÊýµ÷ÓÃ
<function>mysql_connect</function>
º¯ÊýÀ´½¨Á¢Ò»¸öÁ¬½Ó²¢Ê¹ÓÃÖ®¡£
</para>
<para>
¿ÉÑ¡µÄ
<parameter>result_mode</parameter>
²ÎÊý¿ÉÒÔÊÇ
MYSQL_USE_RESULT ºÍ MYSQL_STORE_RESULT¡£Ä¬ÈÏÊÇ
MYSQL_STORE_RESULT£¬Òò´Ë½á¹û»á±»»º´æ¡£Óë´Ë»¥²¹µÄÐÐΪ²Î¼û
<function>mysql_unbuffered_query</function>¡£
</para>
<note>
<para>
²éѯ×Ö·û´®²»Ó¦ÒԷֺŽáÊø¡£
</para>
</note>
<para>
<function>mysql_query</function> ½ö¶Ô
SELECT£¬SHOW£¬EXPLAIN »ò DESCRIBE
Óï¾ä·µ»ØÒ»¸ö×ÊÔ´±êʶ·û£¬Èç¹û²éѯִÐв»ÕýÈ·Ôò·µ»Ø
&false;¡£¶ÔÓÚÆäËüÀàÐ굀 SQL
Óï¾ä£¬<function>mysql_query</function>
ÔÚÖ´Ðгɹ¦Ê±·µ»Ø &true;£¬³ö´íʱ·µ»Ø &false;¡£·Ç
&false;
µÄ·µ»ØÖµÒâζ×ŲéѯÊǺϷ¨µÄ²¢Äܹ»±»·þÎñÆ÷Ö´ÐС£Õâ²¢²»ËµÃ÷ÈκÎÓйØÓ°Ïìµ½µÄ»ò·µ»ØµÄÐÐÊý¡£
ºÜÓпÉÄÜÒ»Ìõ²éѯִÐгɹ¦Á˵«²¢Î´Ó°Ïìµ½»ò²¢Î´·µ»ØÈκÎÐС£
</para>
<para>
ÒÔϲéѯÓï·¨ÉÏÓÐ´í£¬Òò´Ë
<function>mysql_query</function>
ʧ°Ü²¢·µ»Ø &false;£º
<example>
<title><function>mysql_query</function></title>
<programlisting role="php">
<![CDATA[
<php
$result = mysql_query("SELECT * WHERE 1=1")
or die("Invalid query: " . mysql_error());
?>
]]>
</programlisting>
</example>
</para>
<para>
ÒÔϲéѯµ±
<literal>my_col</literal>
²¢²»ÊDZí
<literal>my_tbl</literal>
ÖеÄÁÐʱÓïÒåÉÏÓÐ´í£¬Òò´Ë
<function>mysql_query</function>
ʧ°Ü²¢·µ»Ø &false;£º
<example>
<title><function>mysql_query</function></title>
<programlisting role="php">
<![CDATA[
<?php
$result = mysql_query("SELECT my_col FROM my_tbl")
or die("Invalid query: " . mysql_error());
?>
]]>
</programlisting>
</example>
</para>
<para>
Èç¹ûûÓÐȨÏÞ·ÃÎʲéѯÓï¾äÖÐÒýÓõıíʱ£¬<function>mysql_query</function>
Ò²»á·µ»Ø &false;¡£
</para>
<para>
¼Ù¶¨²éѯ³É¹¦£¬¿ÉÒÔµ÷ÓÃ
<function>mysql_num_rows</function>
À´²é¿´¶ÔÓ¦ÓÚ SELECT
Óï¾ä·µ»ØÁ˶àÉÙÐУ¬»òÕßµ÷ÓÃ
<function>mysql_affected_rows</function>
À´²é¿´¶ÔÓ¦ÓÚ
DELETE£¬INSERT£¬REPLACE »ò UPDATE
Óï¾äÓ°Ïìµ½Á˶àÉÙÐС£
</para>
<para>
½ö¶Ô SELECT£¬SHOW£¬DESCRIBE »ò EXPLAIN Óï¾ä
<function>mysql_query</function>
²Å»á·µ»ØÒ»¸öеĽá¹û±êʶ·û£¬¿ÉÒÔ½«Æä´«µÝ¸ø
<function>mysql_fetch_array</function>
ºÍÆäËü´¦Àí½á¹û±íµÄº¯Êý¡£´¦ÀíÍê½á¹û¼¯ºó¿ÉÒÔͨ¹ýµ÷ÓÃ
<function>mysql_free_result</function>
À´ÊÍ·ÅÓëÖ®¹ØÁªµÄ×ÊÔ´£¬¾¡¹Ü½Å±¾Ö´ÐÐÍê±Ïºó»á×Ô¶¯ÊÍ·ÅÄÚ´æ¡£
</para>
<para>
²Î¼û
<function>mysql_num_rows</function>£¬<function>mysql_affected_rows</function>£¬<function>mysql_unbuffered_query</function>£¬<function>mysql_free_result</function>£¬<function>mysql_fetch_array</function>£¬<function>mysql_fetch_row</function>£¬<function>mysql_fetch_assoc</function>£¬<function>mysql_result</function>£¬<function>mysql_select_db</function>
ºÍ
<function>mysql_connect</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
-->