cvs: phpdoc-zh /reference/mysql/functions mysql-connect.xml

From: Date: Tue, 25 Feb 2003 09:38:11 +0000
Subject: cvs: phpdoc-zh /reference/mysql/functions mysql-connect.xml
Groups: php.doc.zh 
Request: Send a blank email to doc-zh+get-1135@lists.php.net to get a copy of this message
dallas Tue Feb 25 04:38:11 2003 EDT Added files: /phpdoc-zh/reference/mysql/functions mysql-connect.xml Log: Complete 1.6 Index: phpdoc-zh/reference/mysql/functions/mysql-connect.xml +++ phpdoc-zh/reference/mysql/functions/mysql-connect.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.6 Maintainer: dallas Status: ready --> <refentry id="function.mysql-connect"> <refnamediv> <refname>mysql_connect</refname> <refpurpose>´ò¿ªÒ»¸öµ½ MySQL ·þÎñÆ÷µÄÁ¬½Ó</refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>resource</type><methodname>mysql_connect</methodname> <methodparam choice="opt"><type>string</type><parameter> server </parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter> username </parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter> password </parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter> new_link </parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter> client_flags </parameter></methodparam> </methodsynopsis> <para> Èç¹û³É¹¦Ôò·µ»ØÒ»¸ö MySQL Á¬½Ó±êʶ£¬Ê§°ÜÔò·µ»Ø &false;¡£ </para> <para> <function>mysql_connect</function> ½¨Á¢Ò»¸öµ½ MySQL ·þÎñÆ÷µÄÁ¬½Ó¡£µ±Ã»ÓÐÌṩ¿ÉÑ¡²ÎÊýʱʹÓÃÒÔÏÂĬÈÏÖµ£º<parameter>server</parameter> = 'localhost:3306'£¬<parameter>username</parameter> = ·þÎñÆ÷½ø³ÌËùÓÐÕßµÄÓû§Ãû£¬<parameter>password</parameter> = ¿ÕÃÜÂë¡£ </para> <para> <parameter>server</parameter> ²ÎÊý¿ÉÒÔ°üÀ¨¶Ë¿ÚºÅ¡£ÀýÈç &quot;hostname:port&quot; »òÕßÊǵ½±¾µØÌ×½Ó×ֵķ¾¶£¬ÀýÈç±¾»úÉ쵀 &quot;:/path/to/socket&quot;¡£ <note> <para> ÎÞÂÛÖ¸¶¨ &quot;localhost&quot; »òÕß &quot;localhost:port&quot; ×÷Ϊ <parameter>server</parameter>£¬MySQL ¿Í»§¶Ë¿â½«¸²¸ÇÖ®²¢³¢ÊÔÁ¬½Óµ½±¾µØÌ×½Ó×Ö£¨Windows ÖеÄÃû×ֹܵÀ£©¡£Èç¹ûÏ£ÍûʹÓà TCP/IP Á¬½Ó£¬Óà &quot;127.0.0.1&quot; Ìæ´ú &quot;localhost&quot;¡£Èç¹û MySQL ¿Í»§¶Ë¿âÊÔͼÁ¬½Óµ½´íÎóµÄ±¾µØÌ×½Ó×Ö£¬ÔòÓ¦¸ÃÔÚ PHP ÅäÖÃÖн« mysql.default_host ÉèΪÕýÈ·µÄ·¾¶²¢Ê¹ server ×Ö¶ÎΪ¿Õ¡£ </para> <para> &quot;:port&quot; µÄÖ§³ÖÊÇ PHP 3.0B4 Æð¼ÓÈëµÄ¡£ </para> <para> &quot;:/path/to/socket&quot; µÄÖ§³ÖÊÇ PHP 3.0.10 Æð¼ÓÈëµÄ¡£ </para> <para> ¿ÉÒÔÔÚº¯ÊýÃûǰ¼ÓÉÏ <link linkend="language.operators.errorcontrol">@</link> À´ÒÖÖÆÊ§°Üʱ²úÉúµÄ´íÎóÐÅÏ¢¡£ </para> </note> </para> <para> Èç¹ûÓÃͬÑùµÄ²ÎÊýµÚ¶þ´Îµ÷Óà <function>mysql_connect</function>£¬½«²»»á½¨Á¢ÐÂÁ¬½Ó£¬¶ø½«·µ»ØÒѾ­´ò¿ªµÄÁ¬½Ó±êʶ¡£²ÎÊý <parameter>new_link</parameter> ¸Ä±ä´ËÐÐΪ²¢Ê¹ <function>mysql_connect</function> ×ÜÊÇ´ò¿ªÐµÄÁ¬½Ó£¬ÉõÖÁµ± <function>mysql_connect</function> ÔøÔÚÇ°Ãæ±»ÓÃͬÑùµÄ²ÎÊýµ÷Óùý¡£²ÎÊý <parameter>client_flags</parameter> ¿ÉÒÔÊÇÒÔϳ£Á¿µÄ×éºÏ£ºMYSQL_CLIENT_COMPRESS£¬MYSQL_CLIENT_IGNORE_SPACE »òÕß MYSQL_CLIENT_INTERACTIVE¡£ </para> <note> <para> <parameter>new_link</parameter> ²ÎÊý×Ô PHP 4.2.0 Æð¿ÉÓᣠ</para> <para> <parameter>client_flags</parameter> ²ÎÊý×Ô PHP 4.3.0 Æð¿ÉÓᣠ</para> </note> <para> Ò»µ©½Å±¾½áÊø£¬µ½·þÎñÆ÷µÄÁ¬½Ó¾Í»á±»¹Ø±Õ¡£³ý·Ç֮ǰÒѾ­µ÷ÓÃÁË <function>mysql_close</function> À´¹Ø±ÕËü¡£ </para> <example> <title>MySQL Á¬½ÓÀý×Ó</title> <programlisting role="php"> <![CDATA[ <?php $link = mysql_connect("localhost", "mysql_user", "mysql_password") or die("Could not connect: " . mysql_error()); print ("Connected successfully"); mysql_close($link); ?> ]]> </programlisting> </example> <para> ²Î¼û <function>mysql_pconnect</function> ºÍ <function>mysql_close</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 -->

« previous php.doc.zh (#1135) next »