cvs: phpdoc-zh /reference/mysql/functions mysql-connect.xml /reference/pgsql reference.xml
| From: | Dallas Thunder | Date: | Thu, 06 Oct 2005 16:41:07 +0000 |
| Subject: | cvs: phpdoc-zh /reference/mysql/functions mysql-connect.xml /reference/pgsql reference.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-2674@lists.php.net to get a copy of this message | ||
dallas Thu Oct 6 12:41:07 2005 EDT
Modified files:
/phpdoc-zh/reference/mysql/functions mysql-connect.xml
/phpdoc-zh/reference/pgsql reference.xml
Log:
Updated.
http://cvs.php.net/diff.php/phpdoc-zh/reference/mysql/functions/mysql-connect.xml?r1=1.3&r2=1.4&ty=u
Index: phpdoc-zh/reference/mysql/functions/mysql-connect.xml
diff -u phpdoc-zh/reference/mysql/functions/mysql-connect.xml:1.3
phpdoc-zh/reference/mysql/functions/mysql-connect.xml:1.4
--- phpdoc-zh/reference/mysql/functions/mysql-connect.xml:1.3 Mon Sep 19 13:02:43 2005
+++ phpdoc-zh/reference/mysql/functions/mysql-connect.xml Thu Oct 6 12:41:05 2005
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="gb2312"?>
-<!-- $Revision: 1.3 $ -->
+<!-- $Revision: 1.4 $ -->
<!-- $Author: dallas $ -->
-<!-- EN-Revision: 1.16 Maintainer: dallas Status: ready -->
+<!-- EN-Revision: 1.18 Maintainer: dallas Status: ready -->
<refentry id="function.mysql-connect">
<refnamediv>
<refname>mysql_connect</refname>
@@ -74,7 +74,7 @@
<para>
<parameter>client_flags</parameter>
²ÎÊý¿ÉÒÔÊÇÒÔϳ£Á¿µÄ×éºÏ£º<constant>MYSQL_CLIENT_COMPRESS</constant>£¬<constant>MYSQL_CLIENT_IGNORE_SPACE</constant>
- »ò <constant>MYSQL_CLIENT_INTERACTIVE</constant>¡£
+ »ò
<constant>MYSQL_CLIENT_INTERACTIVE</constant>¡£½øÒ»²½ÐÅÏ¢¼û<xref
linkend="mysql.client-flags" />¡£
</para>
</listitem>
</varlistentry>
@@ -150,6 +150,61 @@
</programlisting>
</example>
</para>
+ <para>
+ <example>
+ <title><function>mysql_connect</function> Àý×Ó£ºÊ¹ÓÃ
<literal>hostname:port</literal> Óï·¨</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// we connect to example.com and port 3307
+$link = mysql_connect('example.com:3307', 'mysql_user',
'mysql_password');
+if (!$link) {
+ die('Could not connect: ' . mysql_error());
+}
+echo 'Connected successfully';
+mysql_close($link);
+
+// we connect to localhost at port 3307
+$link = mysql_connect('127.0.0.1:3307', 'mysql_user',
'mysql_password');
+if (!$link) {
+ die('Could not connect: ' . mysql_error());
+}
+echo 'Connected successfully';
+mysql_close($link);
+?>
+]]>
+ </programlisting>
+ </example>
+ </para
+ <para>
+ <example>
+ <title><function>mysql_connect</function> Àý×Ó£ºÊ¹ÓÃ
":/path/to/socket" Óï·¨</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// we connect to localhost and socket e.g. /tmp/mysql.sock
+
+//variant 1: ommit localhost
+$link = mysql_connect('/tmp/mysql', 'mysql_user', 'mysql_password');
+if (!$link) {
+ die('Could not connect: ' . mysql_error());
+}
+echo 'Connected successfully';
+mysql_close($link);
+
+
+// variant 2: with localhost
+$link = mysql_connect('localhost:/tmp/mysql.sock', 'mysql_user',
'mysql_password');
+if (!$link) {
+ die('Could not connect: ' . mysql_error());
+}
+echo 'Connected successfully';
+mysql_close($link);
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
</refsect1>
<refsect1 role="notes">
@@ -160,7 +215,8 @@
"localhost:port"£¬MySQL
¿Í»§¶Ë¿â»áÔ½¹ý´ËÖµ²¢³¢ÊÔÁ¬½Óµ½±¾µØÌ×½Ó×Ö£¨Windows
ÖеÄÃû×ֹܵÀ£©¡£Èç¹ûÏëÓà TCP/IP£¬Ó¦¸ÃÓÃ
"127.0.0.1"
´úÌæ "localhost"¡£Èç¹û MySQL
¿Í»§¶Ë¿âÊÔͼÁ¬½Óµ½Ò»¸ö´íÎóµÄ±¾µØÌ×½Ó×Ö£¬ÔòÓ¦¸ÃÔÚ
- PHP ÅäÖÃÖÐÉ趨 mysql.default_host µÄÕýȷ·¾¶²¢°Ñ server Áô¿Õ¡£
+ PHP ÅäÖÃÖÐÉ趨 <xref linkend="ini.mysql.default-host" />
+ µÄÕýȷ·¾¶²¢°Ñ server Áô¿Õ¡£
</para>
</note>
<note>
http://cvs.php.net/diff.php/phpdoc-zh/reference/pgsql/reference.xml?r1=1.12&r2=1.13&ty=u
Index: phpdoc-zh/reference/pgsql/reference.xml
diff -u phpdoc-zh/reference/pgsql/reference.xml:1.12 phpdoc-zh/reference/pgsql/reference.xml:1.13
--- phpdoc-zh/reference/pgsql/reference.xml:1.12 Tue Sep 20 17:26:30 2005
+++ phpdoc-zh/reference/pgsql/reference.xml Thu Oct 6 12:41:07 2005
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="gb2312"?>
-<!-- $Revision: 1.12 $ -->
+<!-- $Revision: 1.13 $ -->
<!-- $Author: dallas $ -->
-<!-- EN-Revision: 1.28 Maintainer: dallas Status: ready -->
+<!-- EN-Revision: 1.29 Maintainer: dallas Status: ready -->
<!-- Purpose: database.vendors -->
<!-- Membership: bundled, external -->
@@ -83,7 +83,7 @@
<![CDATA[
<?php
// Á¬½Ó£¬Ñ¡ÔñÊý¾Ý¿â
-$dbconn = pg_connect("host=localhost dbname=publishing user=www password=foo");
+$dbconn = pg_connect("host=localhost dbname=publishing user=www password=foo")
or die('Could not connect: ' . pg_last_error());
// Ö´ÐÐ SQL ²éѯ